#include<fstream>
#include<iostream>
using
namespace
std;
int
main()
{
ifstream in;
int
a[10];
int
j=0;
in.open(
"data.txt"
,ios_base::in);
//你自己要先新建一个num.txt来放数字
while
(!in.eof())
{
in>>a[j];
cout<<
"a["
<<j<<
"]="
<<a[j]<<endl;
j++;
}
in.close();
system
(
"pause"
);
return
0;
}
|