when converting iget erros especially in the cin parts because they are automatically passed by something
#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
int p=1;
class Bank
{
public:
char name[50],address[90],type;
double ein_betrag, aus_betrag;
double balance;
int costumernr, accountnr, birth, tel;
public:
void newcostumer();
void newaccount();
void costumerdel();
void accountdel();
void deposit();
void withdraw();
void accountinfo();
};
void Bank::newcostumer()
{
cout<<"\n Enter your name : " << endl;
cin>>name;
cout << " Enter your address: " << endl;
cin >>address;
cout << " your tel nr please: " << endl;
cin >>tel;
cout << " Enter your gebdatum: " << endl;
cin >>birth;
cout<<"\n Enter your type of account :\n s for SAVING account \n f for FIXED account : ";
cin>>type;
cout<<"\nEnter your starting balance : "<< endl;
cin>>balance;
if(balance<10)
{
cout<<" The minimum balance is Euro 10";
}
accountnr=1000+p;
cout<<" Your account number is : "<<accountnr<<" Always remember it";
}
void Bank::costumerdel() {
costumernr = 0;
birth = 0;
tel = 0;
address[90] = 0;
}
void Bank::accountdel() {
accountnr = 0;
balance = 0;
};
void Bank::deposit()
{
unsigned long int x;
cout<<"\nEnter the amount to be deposited : ";
cin>>x;
balance=balance+x;
cout<<"\n Your new balance is : Euro "<<balance;
}
void Bank::withdraw()
{
unsigned long int x;
cout<<"\n Your balance is : "<<balance;
if(type=='s')
{
cout<<"\nenter the amount to be withdrawn : ";
cin>>x;
if( x<=(balance-10))
{
balance-=x;
cout<<"\nNew account balance is : "<<balance;
}
else
{
cout<<"\n Not possible for you ";
}
}
else
cout<<"\n NOT possible for you ";
}
void Bank::accountinfo()
{
cout<<"\n Hello "<<name<<" Your account balance is : "<<balance;
}
int main()
{
char ch;int n,x;
Bank e[100];
star:cout<<"\n Are you a new user(y/n) : \n Press x To go out of system";
cin>>ch;
if(ch=='y'||ch=='Y')
{
e[p].newcostumer();
p++; getch();
goto star;
}
else
{
if(ch=='x'||ch=='X')
{
goto end;
}
else
cout<<"\n Enter your account no. : ";
cin>>n;
n-=1000;
if(n>0)
{
cout<<"\n Enter your choice \n 1.New Account \n 2.Costumer delete \n 3.Account delete \n 4.deposit \n 5.Withdrawal \n 6.Transaction \n 7.Check your account\n 8.exit \n 9.To go out of system:";
cin>>x;
while(x!=8)
{
switch(x)
{
case 1:
e[n].newcostumer();break;
case 2:
e[n].costumerdel();break;
case 3:
e[n].accountdel();break;
case 4:
e[n].deposit();break;
case 5:
e[n].withdraw();break;
case 6:
e[n].transaction();break;
case 7:
e[n].accountinfo();break;
case 9:
goto end;
default:
cout<<"\nInvalid";
}
cout<<"\n Enter your choice \n 1.New Account \n 2.Costumer delete \n 3.Account delete \n 4.deposit \n 5.Withdrawal \n 6.Transaction \n 7.Check your account\n 8.exit \n 9.To go out of system:";
cin>>x;
} goto star;
}
else
cout<<"\nInvalid";
}end:;
}