fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. void fill( std::vector<float> &vec1, std::vector<float> &vec2 );
  5. void show( const std::vector<float> &vec );
  6.  
  7. int main()
  8. {
  9. std::vector<float> vec1;
  10. std::vector<float> vec2;
  11. fill( vec1, vec2 );
  12.  
  13. show( vec1 );
  14. std::cout << "\n";
  15. show( vec2 );
  16.  
  17. return 0;
  18. }
  19.  
  20. void fill( std::vector<float> &vec1 , std::vector<float> &vec2 )
  21. {
  22. vec1.push_back( -0.5f );
  23. vec1.push_back( 0.5f );
  24. vec1.push_back( 1.5f );
  25.  
  26. vec2.push_back( 0.5f );
  27. vec2.push_back( 0.5f );
  28. vec2.push_back( 1.5f );
  29. }
  30.  
  31. void show( const std::vector<float> &vec )
  32. {
  33. for( unsigned int i = 0; i < vec.size(); ++i )
  34. {
  35. std::cout << vec[i] << "/n";
  36. }
  37. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
-0.5/n0.5/n1.5/n
0.5/n0.5/n1.5/n