Marisichka

Untitled

Oct 2nd, 2021
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.  
  6.     int** arr = new int* [2];
  7.     arr[0] = new int[10]{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  8.     arr[1] = new int[10]{ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
  9.  
  10.     for (size_t i = 0; i < 2; i++){
  11.  
  12.         for (size_t j = 0; j < 10; j++)
  13.  
  14.             cout << arr[i][j] << ' ';
  15.  
  16.         cout << endl;
  17.     }
  18.  
  19.     cout << endl;
  20.  
  21.     swap(arr[0], arr[1]);
  22.  
  23.     for (size_t i = 0; i < 2; i++){
  24.  
  25.         for (size_t j = 0; j < 10; j++)
  26.  
  27.             cout << arr[i][j] << ' ';
  28.  
  29.         cout << endl;
  30.     }
  31.  
  32.     cout << endl;
  33.  
  34.     delete[] arr[0], arr[1], arr;
  35.  
  36.     return 0;
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment