10iv.cpp

来自「《C/C++程序设计导论(第二版)》一书的程序源文件」· C++ 代码 · 共 14 行

CPP
14
字号
// InputAnswerKey()  Reads a disk file for a quiz answer key and
//  sets the correct answers in the array `answers'.
//  ASSUMPTION; input file exists and contains 5 answers
//  IN:		keyfile is a string for the input file name
//			size is the array size
//  	OUT:		answers is an array for the correct quiz answers
#include <fstream.h>
#include "Cstring.h"
void InputAnswerKey (String keyfile, char ans[ ], int size)
{	ifstream infile (keyfile, ios::in);
	for (int n=0; n<size; n++)			
		infile >> ans[n];
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?