首页 > 其他 > 详细

如何把样例从文件中输入程序

时间:2020-02-11 00:04:42      阅读:101      评论:0      收藏:0      [点我收藏+]
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main()
{
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    int a;
    cin>>a;
    cout<<a*a;
    return 0;
}

提前在程序所在的文件夹中创建in.txt和out.txt

如何把样例从文件中输入程序

原文:https://www.cnblogs.com/h694879357/p/12293205.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!