记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:19:3: error: 'sin' was not declared in this scope
   19 |   sin >> c;
      |   ^~~
foo.cc:22:17: error: 'k' was not declared in this scope
   22 |    st.push({ c, k });
      |                 ^
foo.cc:22:20: error: no matching function for call to 'std::stack<ch>::push(<brace-enclosed initializer list>)'
   22 |    st.push({ c, k });
      |                    ^
In file included from /usr/include/c++/9/stack:61,
                 from foo.cc:3:
/usr/include/c++/9/bits/stl_stack.h:233:7: note: candidate: 'void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = ch; _Sequence = std::deque<ch, std::allocator<ch> >; std::stack<_Tp, _Sequence>::value_type = ch]'
  233 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_stack.h:233:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const ch&'}
  233 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_stack.h:238:7: note: candidate: 'void std::stack<_Tp, _Sequence>::push(std::stack<_Tp, _Sequence>::value_type&&) [with _Tp = ch; _Sequence = std::deque<ch, std::allocator<ch> >; std::stack<_Tp, _Sequence>::value_type = ch]'
  238 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_stack.h:238:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::stack<ch>::value_type&&' {aka 'ch&&'}
  238 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
foo.cc:29:29: error: 'k' was not declared in this scope
   29 |     cout << "rightmore " << k << endl;
      |                             ^
foo.cc:30:5: error: break statement not within loop or switch
   30 |     break;
      |     ^~~~~
foo.cc:36:3: error: 'k' was not declared in this scope
   36 |   k++;
      |   ^
foo.cc: At global scope:
foo.cc:38:2: error: expected unqualified-id before 'if'
   38 |  if (flag)
      |  ^~
foo.cc:52:2: error: expected unqualified-id before 'return'
   52 |  return 0;
      |  ^~~~~~
foo.cc:53:1: error: expected declaration before '}' token
   53 | }
      | ^
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
自测
题目
P1055 OO11-7 stack和括号的匹配、失配
语言
C++
递交时间
2022-05-13 14:38:58
评测时间
2022-05-13 14:38:58
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes