读文件

 1 #include<iostream>
 2 #include<fstream>
 3 using namespace std;
 4 int main()
 5 {
 6     int a;
 7     ifstream fi;
 8     fi.open("a.txt");
 9     while (fi >> a)
10     {
11         cout << a<<" ";
12     }
13     cout << endl;
14     system("pause");
15 }

原文地址:https://www.cnblogs.com/hsy1941/p/8638419.html