我在clion中创建的c++工程,从console中读入数据,并将数据用ofstream输出到文件output.txt
只是这个输出文件中的并不会更新,其内容一直都是第一次输入时的数据
#include<iostream>
#include<fstream>
using namespace std;
int main(){
int a, b, c;
cin >> a >> b >> c;
ofstream out{"output.txt"};
out << a << b << c;
return 0;
}
output.txt中的数字一直都是第一次输入的a
,b
,c
你这里只有一次cin何来多次?