Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
74874 胡盛哲 09计算算数表达式 C++ Compile Error 0 MS 0 KB 392 2024-05-26 11:04:09

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int a,b,c; cin >> a >> b >> c; if(a % b == 0) { cout << "Divided by zero!"; } if(c == +) { cout << a + b; return 0; } if(c == /) { cout << a / b; return 0; } if(c == *) { cout << a * b; return 0; } if(c == -) { cout << a - b; }else{ cout << "Invalid operator!" } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:9:11: error: expected primary-expression before ')' token
  if(c == +) {
           ^
Main.cc:13:10: error: expected primary-expression before '/' token
  if(c == /) {
          ^
Main.cc:13:11: error: expected primary-expression before ')' token
  if(c == /) {
           ^
Main.cc:17:11: error: expected primary-expression before ')' token
  if(c == *) {
           ^
Main.cc:21:11: error: expected primary-expression before ')' token
  if(c == -) {
           ^
Main.cc:25:2: error: expected ';' before '}' token
  }
  ^