foo.cc:17:5: error: cannot declare '::main' to be a global variable
int main
^~~~
foo.cc:19:2: error: expected primary-expression before 'int'
int n;
^~~
foo.cc:19:2: error: expected '}' before 'int'
foo.cc:20:2: error: 'cin' does not name a type; did you mean 'main'?
cin>>n;
^~~
main
foo.cc:21:2: error: 'cout' does not name a type
cout<<f(n);
^~~~
foo.cc:23:2: error: expected unqualified-id before 'return'
return 0;
^~~~~~
foo.cc:24:1: error: expected declaration before '}' token
}
^
[Hydro](https://hydro.ac)提供评测服务