Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
122870 杜春雨 删除单词后缀 C++ Compile Error 0 MS 0 KB 545 2025-06-21 17:40:33

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ string x; getline(cin,x); int a=s.length(); if(x[a-2]='e'&&x[a-1]='r'){ x.erase(len-2,2) } if(x[a-2]='l'&&x[a-1]='y'){ x.erase(len-2,2) }if(x[a-3]='i'&&x[a-2]='n'&&x[a-1]='g'){ x.erase(len-2,2) } cout<<x; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:10:11: error: 's' was not declared in this scope
     int a=s.length();
           ^
Main.cc:11:26: error: lvalue required as left operand of assignment
     if(x[a-2]='e'&&x[a-1]='r'){
                          ^
Main.cc:12:17: error: 'len' was not declared in this scope
         x.erase(len-2,2)
                 ^
Main.cc:14:26: error: lvalue required as left operand of assignment
     if(x[a-2]='l'&&x[a-1]='y'){
                          ^
Main.cc:15:17: error: 'len' was not declared in this scope
         x.erase(len-2,2)
                 ^
Main.cc:16:39: error: lvalue required as left operand of assignment
     }if(x[a-3]='i'&&x[a-2]='n'&&x[a-1]='g'){
                                       ^
Main.cc:17:17: error: 'len' was not declared in this scope
         x.erase(len-2,2)
                 ^