Saturday, May 22, 2010

Help with c++ plz?

i only have one minor and one more than minor problem left


the program goes like this


int option;


cout%26lt;%26lt;"Enter 1 to encrypt, 2 to decrypt, 3 to quit"%26lt;%26lt;endl;


cin%26gt;%26gt;option;


while (option!=3) {


if (option==1) {


cout%26lt;%26lt;"Enter a message to encrypt (! to quit)"%26lt;%26lt;endl;


char letter;


cin%26gt;%26gt;letter;


while (letter!='!'){


if (letter=='k') cout%26lt;%26lt;"1 ";


26 more if stats


cin%26gt;%26gt;letter;


}


}


else if (option==2) {


cout%26lt;%26lt;"Enter a message to decrypt (0 to quit)"%26lt;%26lt;endl;


int code;


cin%26gt;%26gt;code;


while (code!=0){


if (code==1) cout%26lt;%26lt;"k";


26 more if stats


cin%26gt;%26gt;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

Help with c++ plz?
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:





}

blazing star

No comments:

Post a Comment