记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:26:23: error: conflicting declaration 'std::vector<std::vector<int> > M'
   26 |  vector<vector<int> > M(m, vector<int>(n,0) );
      |                       ^
foo.cc:19:14: note: previous declaration as 'std::vector<int> M'
   19 |  vector<int> M(m,n);
      |              ^
foo.cc:29:15: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   29 |    cin>>M[i][j];
      |               ^
foo.cc:30:10: error: invalid initialization of reference of type 'std::vector<std::vector<int> >&' from expression of type 'std::vector<int>'
   30 |  SortCol(M);
      |          ^
foo.cc:7:36: note: in passing argument 1 of 'void SortCol(std::vector<std::vector<int> >&)'
    7 | void SortCol(vector<vector<int> > &M);
      |              ~~~~~~~~~~~~~~~~~~~~~~^
foo.cc:31:9: error: invalid initialization of reference of type 'std::vector<std::vector<int> >&' from expression of type 'std::vector<int>'
   31 |  Output(M);
      |         ^
foo.cc:5:35: note: in passing argument 1 of 'void Output(std::vector<std::vector<int> >&)'
    5 | void Output(vector<vector<int> > &M);
      |             ~~~~~~~~~~~~~~~~~~~~~~^
foo.cc: In function 'void Output(std::vector<std::vector<int> >&)':
foo.cc:36:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |  for(int i=0; i<M.size(); i++)
      |               ~^~~~~~~~~
foo.cc:38:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   for(int j=0; j<M[i].size(); j++)
      |                ~^~~~~~~~~~~~
foo.cc: In function 'void SortRow(std::vector<std::vector<int> >&)':
foo.cc:82:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   82 |  for(int k=0; k<M.size(); k++)
      |               ~^~~~~~~~~
foo.cc: In function 'int main()':
foo.cc:17:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |    scanf("%d", &a[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
6-6 矩阵的列排序
语言
C++
递交时间
2021-12-14 11:15:14
评测时间
2021-12-14 11:15:14
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes