Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. using namespace std;
  4. void main()
  5. {  
  6.     int i, j, k, n, A[25];
  7.     cin >> n;
  8.     srand(time(0));
  9.     for (i = 0; i < n; i++)
  10.     {
  11.         A[i] = rand() % 100; cout << A[i] << " ";
  12.     }
  13.     for (i = 1, k = 0; i < n; i++)
  14.     {
  15.         if (A[i] > A[k]) k = i;
  16.     }
  17.     for (j = k; j < n - 1; j++)
  18.     {
  19.         A[j] = A[j + 1];
  20.     }
  21.     n--;
  22.     cout << " " << endl;
  23.     for (i = 0; i < n; i++)
  24.     {
  25.          cout << A[i] << " ";
  26.     }
  27.     cin.get();
  28.     cin.get();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement