C ++从文件中读取整数

时间:2015-11-12 22:35:42

标签: c++

我正在尝试从txt文件读取整数,现在我在同一行(4和8)的txt文件中放入两个整数,但我的程序保持输出0和0.我做错了什么?

#include <iostream>
#include <fstream>

int main(int argc, const char * argv[]) {

    std::ifstream fin;
    fin.open("Q2.dat");

    int x,y;
    fin >> x >> y;
    std::cout << x << y ;


    return 0;
}

0 个答案:

没有答案