我正在尝试读取两个文件“ListEmployees01.txt”和“ListEmployees02.table”。但该程序仅读取“ListEmployees01.txt”文件,并且cout
只是从该文件中读取。
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
using namespace std;
int main()
{
freopen("ListEmployees01.txt", "r", stdin);
string s;
while (getline(cin, s))
cout << s<<endl;
fclose(stdin);
freopen("ListEmployees02.table", "r", stdin);
while (getline(cin, s))
cout << s<<endl;
}