Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
100613 冯瀚翔 输出成绩等级II C++ Compile Error 0 MS 0 KB 331 2024-12-08 15:43:47

Tests(0/0):


Code:

#include <iostream> using namespace std; int main() { int a; cin>>a; switch (a) { case a>=90: cout<<A; break; case 70>=a<90: cout<<B; break; case 60>=a<70: cout<<C; break; case a<60: cout<<D; break; default: break; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:12: error: the value of 'a' is not usable in a constant expression
    case a>=90:
            ^
Main.cc:5:9: note: 'int a' is not const
     int a;
         ^
Main.cc:8:12: error: the value of 'a' is not usable in a constant expression
    case a>=90:
            ^
Main.cc:5:9: note: 'int a' is not const
     int a;
         ^
Main.cc:9:14: error: 'A' was not declared in this scope
        cout<=a<90:
              ^
Main.cc:11:11: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
    case 70>=a<90:
           ^
Main.cc:12:14: error: 'B' was not declared in this scope
        cout<=a<70:
              ^
Main.cc:14:11: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
    case 60>=a<70:
           ^
Main.cc:14:4: error: duplicate case value
    case 60>=a<70:
    ^
Main.cc:11:4: error: previously used here
    case 70>=a<90:
    ^
Main.cc:15:15: error: 'C' was not declared in this scope
         cout<