I have a simple problem that is driving me crazy. All because I'm so close into solving it, but just don't know how.
Here is what I'm trying to do.
I have a bank program that is suppose to take in your account number, pin number, and if this information matches what is on a data.in file then you will be able to continue on with other menu options; like deposit, withdraw, loads, balance etc....
so the problem is simple. I figure out a way to have the problem match your account number with the number set inside of the data.in but the pin number(a set of different number) is completely ignored.
Here is my code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
//function table
void Deposit();
void Withdraw();
void Transfer();
void Load();
void Balance();
void Help();
int main()
{
int option, loop;
char userid[15], pin[15];
char account[15],name[15];
//menue
do{//main loop
do{ //second inside loop
cout<<"Welcome to BIG FAT BANK FOO ATM!!"<<endl<<endl;
cout<<"Please Enter your account number: ";
cin>>userid;
cout<<endl;
cout<<"Please Enter your PIN number: ";
cin>>pin;
cout<<endl<<endl;
ifstream fin("BANKDATA.in");
while(fin>>account>>name)
{
if (strcmp(userid, pin) == 0)
{
cout<<"Accessing account!...";
loop=0;
}//end of if
else {cout<<"User Not Found!!"<<endl;
cin.ignore(2);
}//end of else
}//end of inside loop
}while(loop!=0);
cout<<"Here are your options: "<<endl<<endl;
cout<<"1: Depost \t"<<"2: Withdraw"<<endl;
cout<<"3: Transfer \t"<<"4: Load"<<endl;
cout<<"5: Balance \t"<<"6: Help"<<endl<<endl;
cout<<"The exit press 0:"<<endl;
cout<<":";
cin>>option;
//if statements
if (option==1)
{
Deposit();
}
if (option==2)
{
Withdraw();
}
if (option==3)
{
Transfer();
}
if (option==4)
{
Load();
}
if (option==5)
{
Balance();
}
if (option==6)
{
Help();
}
else {
cout<<"Invaid entre!! ERROR!!!"<<endl;
cout<<"Press any button to restart"<<endl;
cin.ignore(2);
}
}while(option!=0);//end of main loop
cout<<"Press any button to continue"<<endl;
cin.ignore(2);
return 0;
}// end of main
void Deposit()
{
}
void Withdraw()
{
}
void Transfer()
{
}
void Load()
{
}
void Balance()
{
}
void Help()
{
}
And here is what's inside of the data.in file
12345678 1111
My fist test would be to make sure that the program can match up your account number with your pin number inside the data.in file. If that were to be false repeat the loop until user inputs the right code.
My second test is to display balances and other account information on that data.in file.
So the program would have to read the first two lines of numbers ( account and pin number) to access the rest of information..
My last test would be to allow the program to edit balance information, much like if a user would deposit, withdraw, or transfer money in a real bank...
So can you guys help me here?

New Topic/Question
Reply



MultiQuote





|