Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
99582 zhouzhanyi [在线测评解答教程] A+B Problem C++ Compile Error 0 MS 0 KB 522 2024-11-30 11:56:06

Tests(0/0):


Code:

#include <stdio.h> int main() { int a, b; scanf("%d %d", &a, &b); printf("%d\n", a + b); return 0; } #include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << a + b << endl; return 0; } import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); System.out.print(a + b + "\n"); } }


Run Info:

Main.cc: In function 'int main()':
Main.cc:12:6: error: redefinition of 'int main()'
 int  main()
      ^
Main.cc:2:5: note: 'int main()' previously defined here
 int main()
     ^
Main.cc: At global scope:
Main.cc:20:1: error: 'import' does not name a type
 import java.util.Scanner;
 ^
Main.cc:22:1: error: expected unqualified-id before 'public'
 public class Main {
 ^
Main.cc: In function 'int main()':
Main.cc:5:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &a, &b);
                           ^