studentlist_test.cpp
来自「一次作业练习」· C++ 代码 · 共 30 行
CPP
30 行
/*******************************************************************************
* Student Name: Zou Wenzhu Student Number:1284932 *
********************************************************************************/
#include <fstream>
#include <string>
#include "StudentList.h"
int main(int argc, char *argv[])
{
ifstream fin("C:\\Dev-C++\\MyFiles\\HW6\\6.g_h\\studentlist.txt"); //set the path of the file
if (fin.fail())//if the file cannot be found
{
cout<<"File not found"<<endl;
system("PAUSE");
return -1;
}
StudentList slist; //create a object
slist.read(fin);//read the content of the file from the text file
slist.write(cout);//output the read to the console
system("PAUSE");
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?