Hii! I have been learning C++ for the past 1 month! Just a beginner..I just thought of a new program, like its a bank and u need to enter your password and if its wrong it should display that "ur password is wrong "and if forgot password, it should display 3 questions and x for 1st ques, y for 2nd ques and z for 3rd. if x is selected it should display 3 options and if the correct option is selected it should display the password. If its wrong it should end the program.
I got that idea like 10 mins ago and i programmed it with what i knew. It has some problems i guess. I would be happy if you guys helped me out here! I would like to know the reason behind the problem too!
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int pass,cs,fp,x,y,z;
cout<<"\tWELCOME TO SBI! PLEASE ENTER YOUR BANK PASSWORD\n\n\nFORGOT PASSWORD? Type fp \n\n\tPASSWORD:";
cs=54321;
cin>>pass;
clrscr();
if(pass==cs)
{
clrscr();
cout<<"\n \tJOSHUA! Your available bank balance is Rs.93726378!";
}
if(pass!=cs)
{
cout<<"\n \tPASSWORD IS INVALID! PLEASE TRY AGAIN";
}
cout<<"\t \n You will be asked a set of Security Questions! \n \t Please select any one Question!\n TYPE x for 1st Question, y for 2nd and z for 3rd!! \n 1. What is your full name? \n 2. What is your registered Mobile number? \n 3.What is your email address?\n SELECT:";
if(x)
{
cin>>x;
clrscr();
cout<<"\t \n What is your Full name? \n \t OPTIONS: 1.Joshua Nicholas Vanhaltren \n \t 2. Vanhaltren \n \t 3.Nicholas Joshua. \n ANSWER:";
switch(x)
{
case 1:cout<<"\n \tYour answer is Correct! YOUR PASSWORD IS 54321!!";
break;
case 2:cout<<"\n \tYour answer is Wrong!";
break;
case 3:cout<<"\n \tYour answer is Wrong!";
break;
}
if(y)
{
cin>>y;
clrscr();
cout<<"\t \n What is your registered Mobile Number?\n \t OPTIONS: 1.9443132756 \n \t 2.9600839069 \n \t 3.9443311141 \n OPTION:";
switch(y)
{
case 1:cout<<"\n \t Your answer is Wrong!";
break;
case 2:cout<<"\n \t Your answer is Correct! YOUR PASSWORD IS 54321!!";
break;
case 3:cout<<"\n \t Your answer is Wrong!";
break;
}
}
if(z)
{
cin>>z;
clrscr();
cout<<"\t \n What is your email address?\n \t OPTIONS: 1.zacjosh@gmail.com \n \t 2.zacjosh123@hotmail.com \n \t 3.zacjosh12345@gmail.com \n OPTIONS:";
switch(z)
{
case 1:cout<<"Your answer is Wrong!";
break;
case 2:cout<<"Your answer is Correct! YOUR PASSWORD IS 54321";
break;
case 3:cout<<"Your answer is Wrong!";
break;
}
}
getch();
}
}