Compile Error

foo.cc:6:15: error: expected ‘}’ before ‘;’ token
    6 |         cin>>b;
      |               ^
foo.cc:5:1: note: to match this ‘{’
    5 | {
      | ^
foo.cc:6:12: error: invalid user-defined conversion from ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} to ‘int’ [-fpermissive]
    6 |         cin>>b;
      |         ~~~^~~
In file included from /nix/gcc-13.3.0/include/c++/13.3.0/ios:46,
                 from /nix/gcc-13.3.0/include/c++/13.3.0/istream:40,
                 from /nix/gcc-13.3.0/include/c++/13.3.0/sstream:40,
                 from /nix/gcc-13.3.0/include/c++/13.3.0/complex:45,
                 from /nix/gcc-13.3.0/include/c++/13.3.0/ccomplex:39,
                 from stdc++.h:127:
/nix/gcc-13.3.0/include/c++/13.3.0/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
      |                ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/bits/basic_ios.h:117:16: note:   return type ‘bool’ of explicit conversion function cannot be converted to ‘int’ with a qualification conversion
foo.cc:7:9: error: expected unqualified-id before ‘for’
    7 |         for(int i=1;i<=b;i++)
      |         ^~~
foo.cc:7:21: error: ‘i’ does not name a type
    7 |         for(int i=1;i<=b;i++)
      |                     ^
foo.cc:7:26: error: ‘i’ does not name a type
    7 |         for(int i=1;i<=b;i++)
      |                          ^
foo.cc:15:9: error: ‘cont’ does not name a type; did you mean ‘const’?
   15 |         cont<<ans;
      |         ^~~~
      |         const
foo.cc:16:9: error: expected unqualified-id before ‘return’
   16 |         return 0;
      |         ^~~~~~
foo.cc:17:1: error: expected declaration before ‘}’ token
   17 | }
      | ^

信息

递交者
类型
递交
题目
P1104 G7-1 统计不及格人数
语言
C++
递交时间
2024-10-02 22:30:07
评测时间
2024-10-02 22:30:07
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes