📄 8i.cpp
字号:
// accounts.cpp Create disk file B:ACCNTS.DAT for
// accounts and balances
#include <iostream.h>
#include <fstream.h>
void main ()
{ char done = 'y';
int acntnum; // an account num.
float balance; // an account balance
ofstream outfile; // a file var.
outfile.open ("accnts.dat"); // prepare file for writing
// Now input values from keyboard and write to the disk file...
while (done != 'n')
{ cout << "enter an account number and balance: ";
cin >> acntnum >> balance;
outfile << acntnum << " " << balance << endl;
cout << "another account? enter `y' or `n':";
cin >> done;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -