English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i only have one minor and one more than minor problem left
the program goes like this
int option;
cout<<"Enter 1 to encrypt, 2 to decrypt, 3 to quit"< cin>>option;
while (option!=3) {
if (option==1) {
cout<<"Enter a message to encrypt (! to quit)"< char letter;
cin>>letter;
while (letter!='!'){
if (letter=='k') cout<<"1 ";
26 more if stats
cin>>letter;
}
}
else if (option==2) {
cout<<"Enter a message to decrypt (0 to quit)"< int code;
cin>>code;
while (code!=0){
if (code==1) cout<<"k";
26 more if stats
cin>>code;
}
}
}
return 0;
}
ok the not so minor problem is that i need this program to "reset" (start with the first phrase) every time after a message is decrypted or encrypted, but it will keep repeating the end/dec based on what you did
what do i need to change
and also where do i need to put the endl; to not have the press. any key.. right after the decryption is shown

2007-02-13 07:27:58 · 1 answers · asked by Alex P 2 in Computers & Internet Programming & Design

1 answers

use while to repeat entering if the option is not 1,2,3

to repeat all the code
use while (1) { your code }


rewrite your code use

switch (option) {

case 1:
break;
case2:
break;
case3:

}

2007-02-13 08:06:18 · answer #1 · answered by iyiogrenci 6 · 0 0

fedest.com, questions and answers