Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
149753 刘柠锐 简单的分支结构 C++ Compile Error 0 MS 0 KB 223 2026-03-16 17:01:01

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;
                     ^
Main.cc: In function 'int main()':
Main.cc:4:5: error: 'cin' was not declared in this scope
     cin>>x;
     ^
Main.cc:4:5: note: suggested alternative:
In file included from Main.cc:1:0:
/usr/include/c++/5/iostream:60:18: note:   'std::cin'
   extern istream cin;  /// Linked to standard input
                  ^
Main.cc:5:14: error: 'cout' was not declared in this scope
     if(x>0){ cout<<"1";
              ^
Main.cc:5:14: note: suggested alternative:
In file included from Main.cc:1:0:
/usr/include/c++/5/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
Main.cc:6:27: error: 'cout' was not declared in this scope
            }else if(x<0){ cout<<"-1"; 
                           ^
Main.cc:6:27: note: suggested alternative:
In file included from Main.cc:1:0:
/usr/include/c++/5/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
Main.cc:7:32: error: 'cout' was not declared in this scope
                         }else{ cout<<"0";
                                ^
Main.cc:7:32: note: suggested alternative:
In file included from Main.cc:1:0:
/usr/include/c++/5/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^