C++文件流输入

来源:互联网 发布:学python要多久 编辑:程序博客网 时间:2024/05/22 06:30


#include <cstdlib>

#include <iostream>
#include <fstream>//导入头文件


using namespace std;


int main(int argc, char *argv[])
{   //ifstream fin("I:\\fin.txt");//方式一
    ifstream fin;
    fin.open("I:\\fin.txt"); //方式二
    int n;
    for(int i=0;i<8;i++){fin>>n;cout<<n<<endl;}
    system("PAUSE");
    return EXIT_SUCCESS;
}
0 0
原创粉丝点击