11-4-2-1.cpp
来自「学习c++的ppt」· C++ 代码 · 共 24 行
CPP
24 行
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
void main()
{ char filename[10];
cout << "输入文件名:";
cin >> filename;
ifstream ifile(filename, ios::in|ios::nocreate);
ofstream ofile("result.txt");
if(! ifile) {
cout << "文件不存在" << endl;
exit(0);
}
if(! ofile) {
cout << "Result.dat 文件不能建立!" << endl;
exit(0);
}
int n;
while(ifile >> n) ofile << 10 *n << ' ';
ifile.close();
ofile.close();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?