?? filter.cpp
字號:
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <iomanip.h>
void main()
{ char filename[10];
void dealString(char ss[]);
cout << "輸入文件名:";
cin >> filename;
ifstream ifile(filename, ios::in|ios::nocreate);
ofstream ofile("result.cpp");
if(! ifile) {
cout << "文件不存在" << endl;
exit(0);
}
if(! ofile) {
cout << "Result.cpp 文件不能建立!" << endl;
exit(0);
}
char str[80];
int cn = 1;
while(! ifile.eof()) {
ifile.getline(str, 80);
dealString(str);
ofile << setw(8) << cn << ":" << str << endl;
cn ++;
}
cout << "轉換成功:Result.cpp 文件已經建立!" << endl;
ifile.close();
ofile.close();
}
void dealString(char ss[])
{ int slen = strlen(ss), i;
for(i = 0; i < slen; i ++) {
if(ss[i] == '/' && ss[i+1] == '/') {
ss[i] = '\0';
break;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -