Spicke

Эрей79

Dec 26th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int N;
  8.     setlocale(LC_ALL, "Russian");
  9.     srand(time(NULL));
  10.     int mas[100];
  11.     cout << "Введите размер массива: "; cin >> N;
  12.     for (int i = 0; i < N; i++)
  13.         mas[i] = 1 + rand() % 5;
  14.     for (int i = 0; i < N; i++)
  15.         cout << mas[i] << " ";
  16.     int K = N;
  17.     while (K > 0) mas[K--] = mas[K - 1];
  18.     mas[0] = 0;
  19.     cout << endl;
  20.     for (int i = 0; i < N; i++)
  21.         cout << mas[i] << " ";
  22.     cout << endl;
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment