Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
149719 gqj 简单的分支结构 C++ Compile Error 0 MS 0 KB 184 2026-03-16 16:49:47

Tests(0/0):


Code:

#include <iostream> using namespace std; int main(){ int a,b; cin>>a; if(a>0){ y=1; cout<<y; }else if(a=0){ y=0; cout<<y; }else{ y=-1; cout<<y; } }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:3: error: 'y' was not declared in this scope
   y=1;
   ^
Main.cc:9:14: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  }else if(a=0){
              ^
Main.cc:10:3: error: 'y' was not declared in this scope
   y=0;
   ^
Main.cc:13:3: error: 'y' was not declared in this scope
   y=-1;
   ^
Main.cc:4:8: warning: unused variable 'b' [-Wunused-variable]
  int a,b;
        ^