我在任务中遇到了标题问题。请任何人尽快帮助我。
/*
member function of studentInfo class; store the value of all data members in
the text file named "record.txt", on separate lines in the text file.
*/
void storeFile()
{
cout<< "All the data members are stored in file." << endl;
ofstream outFile;
const char* outputFileName = "record.txt";
outFile.open(outputFileName, ios::out);
if(!outFile)
{
cout<< "\nUnable to open the file." << outputFileName << endl;
}
else
{
outFile vuID;
outFile endl;
outFile campusID;
outFile endl;
outFile studentName;
outFile endl;
outFile fatherName;
}
}
答案 0 :(得分:2)
outFile endl;
这不好。 endl
是std
命名空间中的标识符。你想用这个做什么?这没有意义。
答案 1 :(得分:1)
您需要将变量放入outputFile e.g。
outFile << vuID;
答案 2 :(得分:1)
outFile vuID
表单不正确,与
相同utFile endl;
应该是
outFile << vuID
和
outFile << endl;