私はこのプロジェクトを行っています 銀行システム このシステムは、銀行の顧客の口座を追跡します。各口座には番号、名前、残高があります。このシステムは、次の機能を提供します。新しいアカウントの作成、引き出し、入金、およびアカウントの閉鎖。
システムには次のインターフェイスがあります:
選択:
1- 新しいアカウントの追加
2- 引き出し
3- 入金
4- 残高の取得
5- 終了
ユーザーが 1 を選択すると、システムは新しい ID を生成し、ユーザーに名前の入力を求めます。そのアカウントのために。初期残高はゼロに設定されます。
ユーザーが 2 を選択すると、システムはユーザーにアカウント ID と引き出し金額を入力するよう求めます。この金額が残高よりも多い場合、残高不足のためにこのトランザクションが失敗したというメッセージが表示されます。残高が十分にあれば、出金する分だけ減っていきます。
ユーザーが 3 を選択した場合。システムは、ユーザーにアカウント ID と入金する金額を入力するよう求めます。システムはこの量だけ残高を増やします。
ユーザーが 4 を選択すると、システムはユーザーに口座 ID を入力するように求め、次に口座の名前と残高を出力します。
タスクが完了するたびに、ユーザーが 5 を選択するまで、システムは上記のメイン メニューに戻ります。
# include <iostream>
#include <string>
using namespace std;
# include<iomanip>
class Bank
{
private:
char name;
int acno;
float balance;
public:
void newAccount();
void withdraw();
void deposit();
void getbalance();
void disp_det();
};
//member functions of bank class
void Bank::newAccount()
{
cout<<"New Account";
cout<<"Enter the Name of the depositor : ";
cin>>name;
cout<<"Enter the Account Number : ";
cin>>acno;
cout<<"Enter the Amount to Deposit : ";
cin >>balance;
}
void Bank::deposit()
{
float more;
cout <<"Depositing";
cout<<"Enter the amount to deposit : ";
cin>>more;
balance+=more;
}
void Bank::withdraw()
{
float amt;
cout<<"Withdrwal";
cout<<"Enter the amount to withdraw : ";
cin>>amt;
balance-=amt;
}
void Bank::disp_det()
{
cout<<"Account Details";
cout<<"Name of the depositor : "<<name<<endl;
cout<<"Account Number : "<<acno<<endl;
cout<<"Balance : $"<<balance<<endl;
}
// main function , exectution starts here
void main(void)
{
Bank obj;
int choice =1;
while (choice != 5 )
{
cout<<"Enter \n 1- to create new account \n 2- Withdraw\n 3- Deposit \n 4- get balance\n 5 Exit"<<endl;
cin>>choice;
switch(choice)
{
case '1' :obj.newAccount();
break;
case '2' :obj.withdraw();
break;
case 3: obj.deposit();
break;
case 4: getbalance();
break;
case 5:
break;
default: cout<<"Illegal Option"<<endl;
}
}
}