Good Day!!!
I have a problem in creating a code using dev cpp. Can you complete my code? This is my code:
#include <iostream.h>
#include <string.h>
void change();
void clue();
void menu();
void compare();
char n1[8];
char n2[8];
char n;
main(){
do{
char name[20];
char n;
system ("cls");
cout<<"Menu:\n";
cout<<"1. Clue:\n";
cout<<"2. Change password?\n";
cout<<"3. Exit\n";
cout<<" Enter your choice:\n";
cin>>n;
system ("cls");
switch (n){
case '1':
char clue1[20];
clue();
break;
case '2':
change();
break;
compare();
break;
case '3':
cout<<"You're done";
break;
}
getchar () ;
getchar () ;
}
while (n!='3') ;
getchar () ;
getchar () ;
return 0 ;
}
void clue () {
cout<<"Enter your password first...\nPress enter!!";
}
void change(){
char ch;
char password[20];
char clue[20];
cout<<"You want to enter your password?\n";
cout<<"Yes or No";
cin>>ch;
if(ch=='y'){
cout<<"Enter your password: ";
cin>>password;
cout<<"Enter your clue: \n";
cin>>clue;
getchar();
system("cls");
menu();
if(n==1){
strcpy(password,clue);
system("cls");
}
}
compare();
}
void menu(){
cout<<"Menu:\n";
cout<<"1. Clue:\n";
cout<<"2. Change password?\n";
cout<<"3. Exit\n";
cout<<" Enter your choice:\n";
cin>>n;
}
void compare(){
int y;
char clue2[20];
char password[20];
char n1[20];
char n2[20];
cout<<"Enter your old password: ";
cin>>n1;
y=(strcmp(password,n1));
if(y!=0){
cout<<"Enter new password: ";
cin>>n2;
cout<<"Enter new clue: ";
cin>>clue2;
cout<<"Congrats!You're done!";
}
else
if(y==0){
system("cls");
cout<<"Invalid Password!";
}
}
Please cooperate with me. I need your response today!!!
Thank you very much. :( :'(