
April 16th, 2005, 01:35 PM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 2
Time spent in forums: 19 m 28 sec
Reputation Power: 0
|
|
Banking system C++
I am doing a banking system in C++ for school and I need some help. There are 3 accounts, when you deposit money in the account is should show you the total amount in the account each time you add money to the account and when you withdraw money it should take away the amount withdraw from the balance that is in the account. Can anyone take a look at my codes and see what I am not doing?
Code:
#include <iostream.h>
#include <stdlib.h>
#include <string.h>
#include <dos.h>
//the list of function prototypes
void Deposit();
void Withdraw();
void Query();
void Show();
void Exit();
char Menu();
int acc, dep, with;
int add = dep + with; //this should add both the deposit and withdraw to give total
int sub= dep - with;
//++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++
int main()
{
char choice;
do{
choice = Menu();
switch(choice)
{
case 'D' : Deposit(); break;
case 'W' :Withdraw();break;
case 'Q' :Query ();break;
case 'S' :Show(); break;
case 'E' :Exit ();break;
default:cout<<"\n\tINVALID ACCOUNT NUMBER ENTERED, PLEASE TRY AGAIN!!!..\n\n\n";
}
}while(choice !='E'); // end of while loop
return 0;
} //This is the end of the main program
//++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++
char Menu()
{
char choice;
cout<<"\tWelcome to Superbank International \n";
cout<<"====================================";
cout<<"\n D Deposit \n ";
cout<<"\n W Withdraw \n";
cout<<"\n Q Query \n";
cout<<"\n S Show all \n";
cout<<"\n E Exit \n";
cout<<"\n\n Option: ";
cin>>choice;
return choice;
}
//+++++++++++++++++++++++++++++++++++++++++++++
void Deposit()
{
system ("cls"); //this will clear the screen
cout<<"Enter the Account Number: ";
cin>>acc;
if ((acc == 25784) ||(acc == 36256)||(acc == 43815) )
{
cout<<"Enter amount to Deposit:$ ";
cin>>dep;
}
else
{
cout<<"\n\n\tSORRY ACCOUNT NUMBER NOT FOUND!!!\n\n";
}
cout<<"\tTRANSACTION APPROVED\n\n";
cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^";
cout<<"\n\nThe Balance on Account " <<acc<< "is $" <<add<<endl;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++
void Withdraw()
{
system ("cls");
cout<<"Enter the Account Number: ";
cin>>acc;
if ((acc == 25784) ||(acc == 36256)||(acc == 43815) )
{
cout<<"Enter amount to Withdraw:$ ";
cin>>with;
}
else
{
cout<<"\n\n\tSORRY ACCOUNT NUMBER NOT FOUND!!!\n\n";
}
cout<<"\tTRANSACTION APPROVED\n\n";
cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^";
cout<<"\n\nThe Balance on Account " <<acc<< "is $" <<sub<<endl;
}
//++++++++++++++++++++++++++++++++++++++++++++++++
void Query()
{
system("cls");
cout<<"some text later";
}
//++++++++++++++++++++++++++++++++++++++++++++++++++
void Show()
{
system("cls");
cout<<"It has been printed";
}
//+++++++++++++++++++++++++++++++++++++
void Exit()
{
system("cls");
cout<<"\n\n\t\tTHANK YOU, FOR USING Superbank International ......\n\n";
exit(1); // quit the programme
}
Last edited by B-Con : April 16th, 2005 at 10:06 PM.
Reason: [code] tags added
|