Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- setlocale(LC_CTYPE, "");
- int n;
- cin >> n;
- int* A = new int [n];
- for (int i = 0; i < n; i++)
- {
- A[i] = 20 + rand() % 47 - 10;
- }
- for (int i = 0; i < n; i++)
- {
- cout << A[i] << " ";
- }
- int max = A[0];
- int maxi = 0;
- for (int i = 0; i < n; i++)
- {
- if (max < A[i]) {
- maxi = i;
- }
- }
- A[maxi] = 100;
- cout << "\n\n";
- for (int i = 0; i < n; i++)
- {
- cout << A[i] << " ";
- }
- delete[] A;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment