Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,671 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,183 people online right now. Registration is fast and FREE... Join Now!




password and clue menu

 
Reply to this topicStart new topic

password and clue menu

janinemarieltorres
post 21 Sep, 2008 - 08:08 PM
Post #1


New D.I.C Head

*
Joined: 21 Sep, 2008
Posts: 2

cpp

#include<iostream.h>
#include<string.h>

main()
{

char a,b,c,ch;
int x,npw;
int temp;
temp=1234;

char y[21],ny[21];
char tempy[21];
tempy[1]='n';
tempy[2]='u';
tempy[3]='m';
tempy[4]='b';
tempy[5]='e';
tempy[6]='r';
char w;


system ("color 0a");

cout<<"\t\t\t\a**menu**";
cout<<"\t\t\n\a(a)show clue\n";
cout<<"\t\t\n\a(b)change password\n";
cout<<"\t\t\n\aŠexit";
cout<<"enter your choice:";
cin>>ch;
system("cls");


if(ch=='c'){
cout<<"\n\n\n\t\t\t\a\abye! kindly click 'x' button";
}else

do{
if(ch=='a'){
do{
cout<<tempy[1]<<tempy[2]<<tempy[3]<<tempy[4]<<tempy[5]<<tempy[6];
cout<<"\n";
cout<<"enter choice again:";

cin>>ch;
system("cls");
system("color 0a");
}while(ch=='a');
}else

do{
if(ch=='b'){
getchar();
do{
cout<<"enter pw:";
cin>>x;

}while(x!=temp);
cout<<"galing!";

cout<<"\n\t\t\aenter new password:";
cin>>npw;
x=temp;
temp=npw;
x=npw;
cout<<"enter new 6 clue's:";
cout<<"\n";
cin>>tempy[1]>>tempy[2]>>tempy[3]>>tempy[4]>>tempy[5]>>tempy[6];
y[21]=tempy[1],tempy[2],tempy[3],tempy[4],tempy[5],tempy[6];
tempy[21]=y[21];
y[21]=ny[21];
getchar();
cout<<"\a password and clue succesfully changed!";

cout<<"enter choice again:";
cin>>ch;
}
}
}
}
}while(ch!='a');
}
}
}while(ch!='b');
system("cls");
}
getchar();
getchar();
return 0;
}




>>this code must show a menu for password and clue but i think there are some errors in my code..my prof said that before we can change our password we must set a password first then the old password and new password will be compared after that we will set our own clue...in anyways if we click the clue first without a password existing in it, it will ask for the password first then for the clue,after that it will go back to the menu...the program will not stop unless if the exit button has been pressed..he also instructed us to add void function but i don't know the function of void and how i will put it in my code!
>>thank you! biggrin.gif

Mod Edit: Please use code tags when posting your code. Code tags are used like so => code.gif

Thanks,
PsychoCoder smile.gif
User is offlineProfile CardPM

Go to the top of the page

Martyr2
post 21 Sep, 2008 - 08:29 PM
Post #2


Programming Theoretician

Group Icon
Joined: 18 Apr, 2007
Posts: 5,062



Thanked 175 times

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions


Have you considered posting this in the proper forum? Like in the C/C++ forum since the code is C/C++ in nature? Might help you get a reasonable answer in a reasonable time. wink2.gif
User is offlineProfile CardPM

Go to the top of the page

shangyi
post 22 Sep, 2008 - 10:58 AM
Post #3


New D.I.C Head

*
Joined: 15 Jun, 2008
Posts: 16


My Contributions


My compiler produced a lot of syntax error from your source code. I have fixed them and organised them. However the logical problem of your code i have not yet solved.

cpp
#include<iostream>
#include<string.h>
using namespace std;
int main()
{

char a,b,c,ch;
int x,npw;
int temp;
temp=1234;

char y[21],ny[21];
char tempy[21];
tempy[1]='n';
tempy[2]='u';
tempy[3]='m';
tempy[4]='b';
tempy[5]='e';
tempy[6]='r';
char w;


system ("color 0a");

cout<<"\t\t\t\a**menu**";
cout<<"\t\t\n\a(a)show clue\n";
cout<<"\t\t\n\a(b)change password\n";
cout<<"\t\t\n\a ©exit";
cout<<"enter your choice:";
cin>>ch;
system("cls");


if(ch=='c')
{
cout<<"\n\n\n\t\t\t\a\abye! kindly click 'x' button";
}else
do{
if(ch=='a')
{
do{
cout<<tempy[1]<<tempy[2]<<tempy[3]<<tempy[4]<<tempy[5]<<tempy[6];
cout<<"\n";
cout<<"enter choice again:";

cin>>ch;
system("cls");
system("color 0a");
}while(ch=='a');
}
else
do{
if(ch=='b')
{
getchar();
do{
cout<<"enter pw:";
cin>>x;
}while(x!=temp);

cout<<"galing!";
cout<<"\n\t\t\aenter new password:";
cin>>npw;
x=temp;
temp=npw;
x=npw;
cout<<"enter new 6 clue's:";
cout<<"\n";
cin>>tempy[1]>>tempy[2]>>tempy[3]>>tempy[4]>>tempy[5]>>tempy[6];
y[21]=tempy[1],tempy[2],tempy[3],tempy[4],tempy[5],tempy[6];
tempy[21]=y[21];
y[21]=ny[21];
getchar();
cout<<"\a password and clue succesfully changed!";

cout<<"enter choice again:";
cin>>ch;
}

}while(ch!='a');

}while(ch!='b');

system("cls");

getchar();
getchar();
return 0;
}


This post has been edited by shangyi: 22 Sep, 2008 - 12:23 PM
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/23/08 06:03AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month