【输入】字符串形式的源程序。
【输出】处理之后的字符串形式的源程序。
【题目】设计一个程序,从任意字符串中剔除C语言形式的注释,包括:
- 形如: //…的单行注释;
- 形如: /…/ 的多行注释。
#include <iostream>
using namespace std;
int filePretreatment(FILE *p1, FILE *p2);
int main(void)
{
FILE *inputFp, *outputFp;
if ((inputFp = fopen("input.txt", "r")) == NULL)
{
cout << "无法打开!" << endl;
exit(1);
}
if ((outputFp = fopen("output.txt", "w")) == NULL)
{
cout << "无法写入!" << endl;
exit(1);
}
cout << "去除注释后为: