Compile Error

foo.cc:3:1: error: expected identifier before ‘int’
    3 | int main()
      | ^~~
foo.cc:2:16: error: expected ‘;’ before ‘int’
    2 | using namespace
      |                ^
      |                ;
    3 | int main()
      | ~~~             
foo.cc: In function ‘int main()’:
foo.cc:6:3: error: expected initializer before ‘cin’
    6 |   cin>>n>>sum;
      |   ^~~
foo.cc:7:3: error: ‘while(n’ was not declared in this scope
    7 |   while(n)
      |   ^~~~~~~~
foo.cc:12:4: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’?
   12 |    cout<<sum;
      |    ^~~~
      |    std::cout
In file included from stdc++.h:146:
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/iostream:63:18: note: ‘std::cout’ declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
foo.cc:12:10: error: ‘sum’ was not declared in this scope
   12 |    cout<<sum;
      |          ^~~
foo.cc:5:7: warning: unused variable ‘n’ [-Wunused-variable]
    5 |   int n,sum;
      |       ^

信息

递交者
类型
自测
题目
P1059 A4-1 回文数专题:数字之和
语言
C++
递交时间
2025-05-16 20:17:59
评测时间
2025-05-16 20:17:59
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes