⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 8i.cpp

📁 C/C++程序设计导论(第二版)》程序源文件
💻 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 + -