记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:16:6: error: conflicting declaration 'int a'
  int a = 0;
      ^
/in/foo.cc:8:14: note: previous declaration as 'std::vector<int> a'
  vector<int> a;
              ^
/in/foo.cc:24:7: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
   a = i;
       ^
In file included from /usr/include/c++/7/vector:69:0,
                 from /in/foo.cc:2:
/usr/include/c++/7/bits/vector.tcc:179:5: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc:179:5: note:   no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
In file included from /usr/include/c++/7/vector:64:0,
                 from /in/foo.cc:2:
/usr/include/c++/7/bits/stl_vector.h:461:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]
       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:461:7: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
/usr/include/c++/7/bits/stl_vector.h:482:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]
       operator=(initializer_list<value_type> __l)
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:482:7: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
/in/foo.cc:35:16: error: 't' was not declared in this scope
    if(a[j] < a[t])
                ^
/in/foo.cc:41:11: error: 't' was not declared in this scope
   if( c > t)
           ^

信息

递交者
类型
递交
题目
4 排序中的交换次数
比赛
小兰赛 2018/12/2
语言
C++
递交时间
2018-12-02 11:24:46
评测时间
2018-12-02 11:24:46
评测机
分数
0
总耗时
300ms
峰值内存
33.816 MiB