Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7.     int x, y;
  8.  
  9.     cin >> x >> y;
  10.  
  11.     int *ptrX = &x;
  12.     int *ptrY = &y;
  13.  
  14.     cout << *ptrX << endl;
  15.     cout << *ptrY << endl;
  16.     cout << *ptrX + *ptrY << endl;
  17.  
  18.     return 0;
  19. }
  20.  
  21.  
  22.  
  23.  
  24.  
  25. #include <iostream>
  26.  
  27. using namespace std;
  28.  
  29. int main ()
  30. {
  31.     int n, arr[100];
  32.  
  33.     cin >> n;
  34.  
  35.     for (int i = 0; i < n; i++)
  36.     {
  37.         cin >> arr[i];
  38.     }
  39.  
  40.     for (int i = n - 1; i >= 0; i--)
  41.     {
  42.         cout << *(arr + i)  << endl;
  43.     }
  44.  
  45.     return 0;
  46. }
  47.  
  48.  
  49.  
  50.  
  51. #include <iostream>
  52.  
  53. using namespace std;
  54.  
  55. int main ()
  56. {
  57.     int n, arr[100];
  58.  
  59.     cin >> n;
  60.  
  61.     for (int i = 0; i < n; i++)
  62.     {
  63.         cin >> arr[i];
  64.     }
  65.  
  66.     int *ptr = (arr + n - 1);
  67.  
  68.     while(n > 0)
  69.     {    
  70.         cout << *ptr << endl;
  71.         ptr--;
  72.         n--;
  73.     }
  74.  
  75.     return 0;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement