Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:7:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    7 |         for(int i=1;i<=n;i++)
      |         ^~~
/in/foo.cc:8:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    8 |                 cin>>a[i];+
      |                           ^
/in/foo.cc:8:27: error: no match for 'operator+' (operand type is 'std::istream' {aka 'std::basic_istream<char>'})
    8 |                 cin>>a[i];+
      |                           ^
    9 |         cin>>q;
      |         ~~~                
/in/foo.cc:8:27: note: candidate: 'operator+(int)' (built-in)
/in/foo.cc:8:27: note:   no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/12/string:47,
                 from /usr/include/c++/12/bits/locale_classes.h:40,
                 from /usr/include/c++/12/bits/ios_base.h:41,
                 from /usr/include/c++/12/ios:42,
                 from /usr/include/c++/12/istream:38,
                 from /usr/include/c++/12/sstream:38,
                 from /usr/include/c++/12/complex:45,
                 from /usr/include/c++/12/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:54,
                 from /in/foo.cc:1:
/usr/include/c++/12/bits/stl_iterator.h:630:5: note: candidate: 'template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
  630 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:630:5: note:   template argument deduction/substitution failed:
/in/foo.cc:9:9: note:   candidate expects 2 arguments, 1 provided
    9 |         cin>>q;
      |         ^~~
/usr/include/c++/12/bits/stl_iterator.h:1786:5: note: candidate: 'template<class _Iterator> std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
 1786 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:1786:5: note:   template argument deduction/substitution failed:
/in/foo.cc:9:9: note:   candidate expects 2 arguments, 1 provided
    9 |         cin>>q;
      |         ^~~
In file included from /usr/include/c++/12/string:53:
/usr/include/c++/12/bits/basic_string.h:3432:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 3432 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3432:5: note:   template argument deduction/substitution failed:
/in/foo.cc:9:9: note:   'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
    9 |         cin>>q;
      |         ^~~
In file included from /usr/include/c++/12/string:54:
/usr/include/c++/12/bits/basic_string.tcc:606:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
  606 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.tcc:606:5: note:   template argument deduction/substitution failed:
/in/foo.cc:9:9: note:   mismatched types 'const _CharT*' and 'std::basic_istream<char>'
    9 |         cin>>q;
      |         ^~~
/usr/include/c++/12/bits/basic_string.tcc:627:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
  627 |     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.tcc:627:5: note:   template argument deduction/substitution failed:
/in/foo.cc:9:9: note:   candidate expects 2 arguments, 1 provided
    9 |         cin>>q;
      |         ^~~
/usr/include/c++/12/bits/basic_string.h:3472:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)'
 3472 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3472:5: note:   template argument deduction/substitution failed:
/in/foo.cc:9:9: note:   'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
    9 |         cin>>q;
      |         ^~~
/usr/include/c++/12/bits/basic_string.h:3489:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)'
 3489 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3489:5: note:   template argument deduction/substitution failed:
/in/foo.cc:9:9: note:   'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
    9 |         cin>>q;
      |         ^~~
/usr/include/c++/12/bits/basic_string.h:3502:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 3502 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3502:5: note:   template argument deduction/substitution failed:
/in/foo.cc:9:9: note:   'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
    9 |         cin>>q;
      |         ^~~
/usr/include/c++/12/bits/basic_string.h:3509:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 3509 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3509:5: note:   template argument deduction/substitution failed:
/in/foo.cc:9:9: note:   'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
    9 |         cin>>q;
      |         ^~~
/usr/include/c++/12/bits/basic_string.h:3516:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 3516 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3516:5: note:   template argument deduction/substitution failed:
/in/foo.cc:9:9: note:   'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
    9 |         cin>>q;
      |         ^~~
/usr/include/c++/12/bits/basic_string.h:3539:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 3539 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3539:5: note:   template argument deduction/substitution failed:
/in/foo.cc:9:9: note:   mismatched types 

信息

递交者
类型
递交
题目
P2810 区间排序4级2 2024.9
语言
C++
递交时间
2025-05-24 14:54:06
评测时间
2025-05-24 14:54:06
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes