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

ok I wrote something not sure how right it is but i do need some help on it
here is what i have:
int menu(int x){
cout<<"Press 1 to encrypt, 2 to decrypt, 3 to quit)"< cin>>x;
return x;
}
void encrypt(char letter){
cout<<"Enter a message to encrypt"< cin>>letter;
while (letter!='!'){
if (letter=='k') cout<<"1 ";
then 26 more if statements for letters
cin>>letter;
}
return;
}



void decrypt(int code){
cin>>code;
while (code!=0){
if (code==1) cout<<"k";
26 more if statements
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

2007-02-26 16:43:18 · 2 answers · asked by Alex P 2 in Computers & Internet Programming & Design

when I try to run this it gives me errors where i put down starts (3 of them)
the error says function does not take 0 arguments
I'm not sure what I'm supposed to put inside the parentheses to make this right
and also, somehow I need to change the function encrypt from encrypt(char) to encrypt(int) I dont know how to do that either

2007-02-26 16:44:43 · update #1

2 answers

Your function menu() does not take zero arguments. It need one argument, as per the function definition. What you want is
int menu(),

and what you have done is

int menu(int x)

And you are not using this parameter x at all.

2007-02-26 16:50:04 · answer #1 · answered by manoj Ransing 3 · 0 0

Surely: your menu() function requires int as an argument.
Check you code thoroughly :-)

2007-02-27 00:53:23 · answer #2 · answered by alakit013 5 · 0 0

fedest.com, questions and answers