Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
149023 赖泓宇 09计算算数表达式 C++ Compile Error 0 MS 0 KB 702 2026-03-06 18:30:33

Tests(0/0):


Code:

include <iostream> using namespace std; int main() { int a, b; char op; // 按照 "a op b" 的格式读取 cin >> a >> op >> b; long long result; // 使用long long防止溢出 switch(op) { case '+': result = (long long)a + b; break; case '-': result = (long long)a - b; break; case '*': result = (long long)a * b; break; case '/': result = (long long)a / b; // 整数除法 break; default: return 1; // 不应该发生 } cout << result << endl; return 0; }


Run Info:

Main.cc:1:1: error: 'include' does not name a type
 include 
 ^
Main.cc: In function 'int main()':
Main.cc:9:5: error: 'cin' was not declared in this scope
     cin >> a >> op >> b;
     ^
Main.cc:30:5: error: 'cout' was not declared in this scope
     cout << result << endl;
     ^
Main.cc:30:23: error: 'endl' was not declared in this scope
     cout << result << endl;
                       ^