What Will Be Output For The Given Codep Pre Langc #2210

What will be output for the given code?</p> <pre><code class="language-c"> #include<bits/stdc++.h> using namespace std; string encrypter(string keyword) { string encoded = ""; bool arr[26] = {0}; for (int i=0; i<keyword.size(); i++) { if(keyword[i] >= 'A' && keyword[i] <= 'Z') { if (arr[keyword[i]-65] == 0) { encoded += keyword[i]; arr[keyword[i]-65] = 1; } } else if (keyword[i] >= 'a' && keyword[i] <= 'z') { if (arr[keyword[i]-97] == 0) { encoded += keyword[i] - 32; alpha[keyword[i]-97] = 1; } } } for (int i=0; i<26; i++) { if(arr[i] == 0) { arr[i]=1; encoded += char(i + 65); } } return encoded; } string ciphertxt(string msg, string encoded) { string cipher=""; for (int i=0; i<msg.size(); i++) { if (msg[i] >='a' && msg[i] <='z') { int pos = msg[i] - 97; cipher += encoded[pos]; } else if (msg[i] >='A' && msg[i] <='Z') { int pos = msg[i] - 65; cipher += encoded[pos]; } else { cipher += msg[i]; } } return cipher; } int main() { string keyword; keyword = "cipher"; string encoded = encrypter(keyword); string message = "hello"; cout << ciphertxt(message,encoded) << endl; return 0; } </code></pre>

Online Quiz This multiple choice question (MCQ) is related to the book/course gs gs122 Data Communication and Computer Network. It can also be found in gs gs122 Cryptography - Monoalphabetic Cipher - Quiz No.1.


Similar question(s) are as followings:



Online Quizzes of gs122 Data Communication and Computer Network

Choose an organization

Theme Customizer

Gaussian Texture



Gradient Background