this program encrypts and decrypts messages, and the encryption/decryption has to be affected by a "shift" variable for example if the value of shift is 7, and k corresponds to 1, the encryption should be 8 instead of 1, and the decryption for k should be 8 and not 1.
i got the encryption down i believe, here is the decryption part:
void decrypt(){
cout<<"Enter a message to decrypt (0 to quit)"<
int code;
cin>>code;
while (code!=0){
if (code==1) cout<<"k";
Followed by 26 more if statements
(will continue in additional details)
Additional Details
2 hours ago
(cont'd)
cin>>code;
}
return;
}
int main(){
int choice;
int shift = 7; // default shift
choice = menu();
while (choice != 3){
if (choice == 1){
cout << "Enter the 'shift' value: ";
cin >> shift;
encrypt(shift); }
else
decrypt();
cout<
choice = menu();
}
return 0;
}
how do i get it to be affected by the shift variable, the thing is i dont think im allowed to add anything to decrypt()
2007-02-26
20:14:17
·
1 answers
·
asked by
Alex P
2
in
Computers & Internet
➔ Programming & Design