SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top