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

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:3:12: error: 'cin' was not declared in this scope
     int x; cin>>x;
            ^
Main.cc:3:12: 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:4:14: error: 'cout' was not declared in this scope
     if(x>0){ cout<<"1"; }
              ^
Main.cc:4: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:5:19: error: 'cout' was not declared in this scope
     else if(x<0){ cout<<"-1"; }else{ cout<<"0"; } 
                   ^
Main.cc:5:19: 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:5:38: error: 'cout' was not declared in this scope
     else if(x<0){ cout<<"-1"; }else{ cout<<"0"; } 
                                      ^
Main.cc:5:38: 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
                  ^