Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
91839 石水生 输出成绩等级II C++ Compile Error 0 MS 0 KB 319 2024-09-22 15:50:20

Tests(0/0):


Code:

#include <bits/stdc++.h> using namespace std; int main(){ int a,c; char b; cin>>a; switch (a){ case a>=90 : cout<<"A"; break; case a>=80 : cout<<"B"; break; case a>=70: cout<<"C"; break; case a>=60: cout<<"D"; break; default: cout<<"E"; break; } }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:11: error: the value of 'a' is not usable in a constant expression
   case a>=90 :
           ^
Main.cc:4:6: note: 'int a' is not const
  int a,c;
      ^
Main.cc:8:11: error: the value of 'a' is not usable in a constant expression
   case a>=90 :
           ^
Main.cc:4:6: note: 'int a' is not const
  int a,c;
      ^
Main.cc:11:11: error: the value of 'a' is not usable in a constant expression
   case a>=80 :
           ^
Main.cc:4:6: note: 'int a' is not const
  int a,c;
      ^
Main.cc:11:11: error: the value of 'a' is not usable in a constant expression
   case a>=80 :
           ^
Main.cc:4:6: note: 'int a' is not const
  int a,c;
      ^
Main.cc:14:11: error: the value of 'a' is not usable in a constant expression
   case a>=70:
           ^
Main.cc:4:6: note: 'int a' is not const
  int a,c;
      ^
Main.cc:14:11: error: the value of 'a' is not usable in a constant expression
   case a>=70:
           ^
Main.cc:4:6: note: 'int a' is not const
  int a,c;
      ^
Main.cc:17:11: error: the value of 'a' is not usable in a constant expression
   case a>=60:
           ^
Main.cc:4:6: note: 'int a' is not const
  int a,c;
      ^
Main.cc:17:11: error: the value of 'a' is not usable in a constant expression
   case a>=60:
           ^
Main.cc:4:6: note: 'int a' is not const
  int a,c;
      ^
Main.cc:4:8: warning: unused variable 'c' [-Wunused-variable]
  int a,c;
        ^
Main.cc:5:7: warning: unused variable 'b' [-Wunused-variable]
  char b;
       ^