Compile Error

/in/foo.cc:5:5: error: cannot declare '::main' to be a global variable
    5 | int main{
      |     ^~~~
/in/foo.cc:7:18: error: expected '}' before ';' token
    7 |         cin>>h>>r;
      |                  ^
/in/foo.cc:5:9: note: to match this '{'
    5 | int main{
      |         ^
/in/foo.cc:7:15: error: invalid user-defined conversion from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' [-fpermissive]
    7 |         cin>>h>>r;
      |         ~~~~~~^~~
In file included from /usr/include/c++/12/ios:44,
                 from /usr/include/c++/12/ostream:38,
                 from /usr/include/c++/12/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/12/bits/basic_ios.h:117:16: note: candidate is: 'std::basic_ios<_CharT, _Traits>::operator bool() const [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  117 |       explicit operator bool() const
      |                ^~~~~~~~
/usr/include/c++/12/bits/basic_ios.h:117:16: note:   return type 'bool' of explicit conversion function cannot be converted to 'int' with a qualification conversion
/in/foo.cc:8:9: error: 'mj' does not name a type
    8 |         mj=r * r * h * pi / 1000;
      |         ^~
/in/foo.cc:9:9: error: 'ts' does not name a type; did you mean 'tm'?
    9 |         ts=cill(20/mj);
      |         ^~
      |         tm
/in/foo.cc:10:9: error: 'cout' does not name a type
   10 |         cout<<ts;
      |         ^~~~
/in/foo.cc:11:9: error: expected unqualified-id before 'return'
   11 |         return 0;
      |         ^~~~~~
/in/foo.cc:12:1: error: expected declaration before '}' token
   12 | }
      | ^

信息

递交者
类型
递交
题目
P1000 大象喝水
语言
C++
递交时间
2025-11-07 20:45:46
评测时间
2025-11-07 20:45:46
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes