i have been asked to solve the following problem
Make a list of pin numbers. Prompt a user for his pin number. If he has entered a valid pin number it, display the message “Welcome to the system. Your pin number is verified”. After that it should give the user options to check his balance as well. If it is not among the valid pin number list, display that “your pin is not verified”. Ask user to enter again. One user can try only 3 times. the program should not get crashed if a character is entered instead of a number.not allowed to use any loops , use only variables
i did some coding but i am stuck on how to make the program work in the three invalid tries area...and also the program crashes if i use a character
#include<iostream.h>
void main()
{
int a,b,c,d,e,f,g,h,i,j,pin,x,y;
a=1234;
b=2345;
c=5321;
d=5674;
e=8753;
f=1237;
g=9456;
h=3467;
i=9128;
j=5190;
x=0;
cout<<"Enter the pin number :";
cin>>pin;
if((x=0) && (pin==a||pin==b||pin==c||pin==d||pin==e||pin==f||p in==g||pin==h||pin==i||pin==j))
{
cout<<"Welcome to the system. Your pin number is verified"<<endl;
cout<<"check your balance"<<endl;
}
else if (pin!=a||pin!=b||pin!=c||pin!=d||pin!=e||pin!=f||p in!=g||pin!=h||pin!=i||pin!=j)
{ cout<<"your pin is not verified"<<endl;
cout<<"Enter the pin number :";
cin>>pin;
x++;
}
if
((x=1) && (pin==a||pin==b||pin==c||pin==d||pin==e||pin==f||p in==g||pin==h||pin==i||pin==j))
{
cout<<"Welcome to the system. Your pin number is verified"<<endl;
cout<<"check your balance"<<endl;
}
else if (pin!=a||pin!=b||pin!=c||pin!=d||pin!=e||pin!=f||p in!=g||pin!=h||pin!=i||pin!=j)
{ cout<<"your pin is not verified"<<endl;
cout<<"Enter the pin number :";
cin>>pin;
x++; }
if
((x=2) && (pin==a||pin==b||pin==c||pin==d||pin==e||pin==f||p in==g||pin==h||pin==i||pin==j))
{
cout<<"Welcome to the system. Your pin number is verified"<<endl;
cout<<"check your balance"<<endl;
}
else if (pin!=a||pin!=b||pin!=c||pin!=d||pin!=e||pin!=f||p in!=g||pin!=h||pin!=i||pin!=j)
{ cout<<"your pin is not verified"<<endl;
cout<<"Enter the pin number :";
cin>>pin;
x++; }
}