Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
149745 余秋烨 简单的分支结构 C++ Compile Error 0 MS 0 KB 196 2026-03-16 16:59:31

Tests(0/0):


Code:

#include <iostream> using namespace std; int main(){ int x; cin>>x; if(x>0){ cout<<"1"; }else if(x<0){ cout<<"-1"; }else{ cout<<"0"; } }


Run Info:

Main.cc:1:21: warning: extra tokens at end of #include directive
 #include  using namespace std; int main(){
                     ^
Main.cc:3:1: error: 'cin' does not name a type
 cin>>x; 
 ^
Main.cc:4:1: error: expected unqualified-id before 'if'
 if(x>0){ cout<<"1";
 ^
Main.cc:5:9: error: expected unqualified-id before 'else'
        }else if(x<0){ cout<<"-1";
         ^
Main.cc:6:22: error: expected unqualified-id before 'else'
                     }else{ cout<<"0";
                      ^
Main.cc:7:28: error: expected declaration before '}' token
                          } }
                            ^