C++,从txt读入,输出到txt,整数

#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
int main(){
	ifstream in("C:\\Users\\lenovo\\Desktop\\input.txt");
	ofstream out("C:\\Users\\lenovo\\Desktop\\output.txt");
	for(string s; getline(in,s);){
		int x;
		for (istringstream sin(s);sin >> x;){
			out << x << endl;
		}
	}
	return 0;
} 
发布了195 篇原创文章 · 获赞 27 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/lgz0921/article/details/103213163