Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int k, max = 0, min = 0;
- do
- {
- cout << "6<=k<=15 Enter k: "; cin >> k;
- if (k < 6 || k>15) cout << "6<=k<=15, Repeat please...\n";
- } while (k < 6 || k>15);
- int* a = new int[k];
- cout << "Enter " << k << " elements:\n";
- for (int i = 0; i < k; i++)
- {
- cin >> a[i];
- if (i == 0 || a[i] > max) max = a[i];
- if (i == 0 || a[i] < min) min = a[i];
- }
- cout << "max=" << max << " " << "min=" << min << endl;
- a[1] = max * min;
- for (int i = 0; i < k; i++)
- cout << a[i] << " ";
- cout << endl;
- delete[]a;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment