fork(7) download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int x;
  8. vector <int> tab;
  9.  
  10. while(cin>>x)
  11. {
  12. tab.push_back(x);
  13. }
  14.  
  15. for(int i = tab.size()-1; i>=0; i--)
  16. {
  17. cout<<tab[i]<<" ";
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 3416KB
stdin
1 2 3
stdout
3 2 1