口座xyzの金額を引き出したいのですが、金額を引き出す際には、書かれています)私は何ができますか?私はC++の銀行システムに関するプロジェクトを持っています。金額を払い戻したいが、金額を払い戻す場合は、特定のポジションのファイルに新しい金額を更新することはできません。
これは私の引き出し機能です。ここで
void withdraw()
{
ofstream f2("bank",ios::out | ios :: app);
ifstream f1("bank",ios::in | ios :: app);
f1.seekg(0);
long long a_num;
long double w_amount;
cout << "Enter Account Number :" << endl;
cin >> a_num;
Bank ac;
while (f1 >> acc_num >> name >> acc_type >> amount){
if(acc_num == a_num){
int g = f1.tellg();
cout << "Get" << g << endl;
int p=g;
acc_num=0;
f2.seekp(p,ios::beg);
cout << "Name :" << name << endl;
cout << "Account type :" << acc_type << endl;
cout << "balance :" << amount << endl;
cout << "Enter withdraw amount : " << endl;
cin >> w_amount;
amount = amount - w_amount;
cout << "Balance :" << amount << endl;
f2.seekp(p,ios::beg);
f2 << amount << endl;
}
}
}
が何のファイル
looks like:
bank.txt
123456789xyz savings 1200
123456789pyr current 1600
を参照してくださいナレッジの詳細については
。あなたはすべてを読んで、修正し、書いて – user463035818