您的位置:首页 > 其它

读取文件中的数据作为输入和输出

2017-08-14 15:53 330 查看
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <cstring>
#include <ctime>
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;

int main()
{
freopen("data.txt", "r", stdin);    ///重定向文件的输入
freopen("output.txt", "w", stdout); ///重定向文件的输输出
int a;
while (cin >> a)               ///从"data.txt"文件中读取数据
{
cout << a << endl;         ///将数据写入到"output.txt"文件中
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  数据 基础知识
相关文章推荐