时间限制: 1Sec 内存限制: 128MB
题目描述
将C程序代码中的双斜杠注释去掉。
输入
输入数据中含有一些符合C++语法的代码行(每行代码不超过200个字符)。需要说明的是,为了方便编程,规定双斜杠注释内容不含有双引号,源程序中没空行。
输出
输出不含有双斜杠注释的C++代码,除了注释代码之外,原语句行格式不变。
样例输入
//======================
// simplest program
//======================
#include
using namespace std;
//----------------------
int main(){
cout<<”hello world!\n”;
}//---------------------
样例输出
#include
using namespace std;
int main(){
cout<<”hello world!\n”;
}
Code
方式一:直接使用定义好的数组
就是占用空间有点多,但是没关系啦
#include<stdio.h>
#include<string.h>
int main()
{
char s[100][200], c;
int i=0, j=0, count=0, row;//row记录最大行数
while (scanf("%c", &c) + 1) {
if (c == '/' && count