解题思路:
注意事项:
参考代码:
#include<bits/stdc++.h>
using namespace std;
int main()
{
string str1="//";
string str;
int k;
while(getline(cin,str))
{
k=str.find(str1);//找到//返回出现//的下标,找不到返回-1
if(k==-1)
{
cout<<str<<endl;
}
else
{
if(k==0)
continue;
for(int i=0;i<k;i++)
{
cout<<str[i];
}
cout<<endl;
}
}
return 0;
}
0.0分
0 人评分