ATM PIN PROBLEM

I've finished my atm program but the problem is when the user inputs his/her pin...it should be covered with *. For example user 1 has a pin of 2001, when she enters 2001,it should look like ****. I also want backspaces and space to be apart of the pin..How can I make this work out for my code its driving me nuts!

Here's My Code:

#include<stdio.h>
#include<iostream.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>

main(){
int wd,dp,bal[11]={0,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000};
int pin[11]={0,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010};
int x,y,c,p,n=1; //x is for array initialization for bal, y is for looping
//c is for goto, p is for array initialization for pin
//n is the number of trials for the pin
//wd,dp,bal and pin is for, withdrawal,deposit,balance and pin respectively
char name[20];
again:clrscr();
cout <<"ENTER USERNAME NUMBER OR ACCOUNT NUMBER: "
<<"\nUSERNAME[0][ "<<" ]\b\b\b";cin>>x;
cout <<"\nENTER YOUR NAME: "; gets(name);
cout <<"ENTER PIN: "; cin>>p;
if(n==3) {cout<<"\nYOU HAVE ENTERED A WRONG PIN 3 TIMES. SORRY.. "; getch(); return 0;}
if(pin[x]!=p) {cout<<"\nYOU HAVE ENTERED A "
<<"WRONG PIN!! PLEASE TRY AGAIN..";
getch(); n++; goto again;}

for(y=0;name[y];y++) //conversion of name characters
name[y]=toupper(name[y]);

for(y=1;y<=10;y++){if(bal[y]==bal[x]){
cout<<"\nWELCOME "<<name<<endl
<<"ACCOUNT NUMBER[0][ "<<x<<" ]"<<endl
<<"BALANCE: "<<bal[x]<<"\nPRESS\t1. WITHDRAWAL"
<<"\n\t2. DEPOSIT \n\t3. BACK TO MENU \n\t4. EXIT\n\n==>>";
cin>>c;
switch(c){
case 1: {cout<<"ENTER AMOUNT TO WITHDRAW: ";cin>>wd;
cout<<"PRESS ANY KEY TO CONTINUE..";
getch(); cout<<"\n\n\tNAME: "<<name<<"\n\tACCOUNT NUMBER[0][ "<<x<<" ]"
<<"\n\tCURRENT BALANCE: "<<bal[x]-wd;
bal[x]-=wd;}break;


case 2: {cout<<"ENTER AMOUNT TO DEPOSIT: ";cin>>dp;
cout<<"PRESS ANY KEY TO CONTINUE..";
getch(); cout<<"\n\n\tNAME: "<<name<<"\n\tACCOUNT NUMBER[0][ "<<x<<" ]"
<<"\n\tCURRENT BALANCE: "<<bal[x]+dp;
bal[x]+=dp;}break;
case 3: goto again;break;
case 4: return 0;
default: return 0; }
cout<<"\n\tPRESS 3 TO RETURN TO MENU: "; cin>>c;
if(c==3) goto again;
}

}
getch();
return 0;
}
Topic archived. No new replies allowed.