fork(6) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int* OdwrocKolejnoscLiczb(int iloscElementow)
  6. {
  7. int* tablica = new int[iloscElementow];
  8. int*w=tablica;
  9.  
  10. int liczby[iloscElementow];
  11.  
  12. for (int i=0; i<iloscElementow;i++)
  13. {
  14. cin>>liczby[i];
  15. *w=i;
  16. w++;
  17.  
  18. }
  19. for (int k=iloscElementow-1; k>=0;k--)
  20. {
  21. cout<<liczby[k]<<" ";
  22. }
  23. cout<<endl;
  24.  
  25. return tablica;
  26.  
  27. }
  28.  
  29. int main()
  30. {
  31. int ileTestow; int ileLiczb;
  32.  
  33. cin>>ileTestow;
  34.  
  35. for (int i=0; i<ileTestow; i++)
  36. {
  37. cin>>ileLiczb;
  38. cout<<OdwrocKolejnoscLiczb(ileLiczb);
  39. }
  40. delete [] OdwrocKolejnoscLiczb(ileLiczb);
  41. return 0;
  42. }
Success #stdin #stdout 0s 4560KB
stdin
2
7 1 2 3 4 5 6 7
3 3 2 11
stdout
7 6 5 4 3 2 1 
0x55fc1b31ce8011 2 3 
0x55fc1b31dec0454619977 0 27