fork download
  1. #include <vector>
  2. #include <stdio.h>
  3. #include <cstdlib>
  4. #include <iostream>
  5.  
  6. typedef std::vector<double> NA;
  7. typedef std::vector<double> NB;
  8.  
  9. NA NI;
  10. NB NO;
  11.  
  12. long i=0,j=0;
  13. int N = 10;
  14. double R;
  15.  
  16. int main(){
  17.  
  18. for(i=0;i!=N;i++){
  19. for(j=i+1;j<N;i++){
  20.  
  21. R = rand();
  22.  
  23. NO.push_back(NI);
  24. NO.at(i).push_back(j);
  25. NO.at(i).at(j) = R;
  26. }
  27. }
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:23:28: error: no matching function for call to ‘std::vector<double>::push_back(NA&)’
             NO.push_back(NI);
                            ^
In file included from /usr/include/c++/6/vector:64:0,
                 from prog.cpp:1:
/usr/include/c++/6/bits/stl_vector.h:914:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = double; _Alloc = std::allocator<double>; std::vector<_Tp, _Alloc>::value_type = double]
       push_back(const value_type& __x)
       ^~~~~~~~~
/usr/include/c++/6/bits/stl_vector.h:914:7: note:   no known conversion for argument 1 from ‘NA {aka std::vector<double>}’ to ‘const value_type& {aka const double&}’
/usr/include/c++/6/bits/stl_vector.h:932:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = double; _Alloc = std::allocator<double>; std::vector<_Tp, _Alloc>::value_type = double]
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/6/bits/stl_vector.h:932:7: note:   no known conversion for argument 1 from ‘NA {aka std::vector<double>}’ to ‘std::vector<double>::value_type&& {aka double&&}’
prog.cpp:24:22: error: request for member ‘push_back’ in ‘NO.std::vector<_Tp, _Alloc>::at<double, std::allocator<double> >(((std::vector<double>::size_type)i))’, which is of non-class type ‘__gnu_cxx::__alloc_traits<std::allocator<double> >::value_type {aka double}’
             NO.at(i).push_back(j);
                      ^~~~~~~~~
prog.cpp:25:22: error: request for member ‘at’ in ‘NO.std::vector<_Tp, _Alloc>::at<double, std::allocator<double> >(((std::vector<double>::size_type)i))’, which is of non-class type ‘__gnu_cxx::__alloc_traits<std::allocator<double> >::value_type {aka double}’
             NO.at(i).at(j) = R;
                      ^~
stdout
Standard output is empty