#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <fstream>
using namespace std;
int main() {
ifstream cin("aaa.txt");
int n;
while(cin >> n) {
cout << n*n << endl;
}
fflush(stdin);
getchar();
/*
fflush(stdin);
功能:清空输入缓冲区,通常是为了确保不影响后面的数据读取
stdin就是标准输入 std即standard(标准),
in即input(输入),合起来就是标准输入。
一般就是指键盘输入到缓冲区里的东西。 */
//system("pause");
return 0;
}
aaa.txt 文件和 cpp 文件在同一目录下
aaa.txt 文件内容如下 :
5
87
程序输出 :
25
64
49
1389

被折叠的 条评论
为什么被折叠?



