Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <clocale>
- #include <cmath>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "Russian");
- int n, m, M, im, iM;
- cout << "Введите количество элементов (разных): ";
- cin >> n;
- int *arr1 = new int [n];
- for ( int i = 0; i < n; i++)
- {
- cout << "\nВведите число: ";
- cin >> arr1[i];
- }
- cout << "\nМы имеем массив:\n";
- im = 0;
- iM = 0;
- m = arr1[im];
- M = arr1[iM];
- for (int i = 0; i < n; i++)
- {
- cout << arr1[i] << "\t";
- if (arr1[i] >= arr1[iM])
- {
- M = arr1[i];
- iM = i;
- }
- else if (arr1[i] <= arr1[im])
- {
- m = arr1[i];
- im = i;
- }
- }
- cout << "\nm=" << arr1[im];
- cout << "\nM=" << arr1[iM];
- cout << "\n";
- for(int i = m + 1; i <= M - 1; i++) {
- int j = 0;
- while(j < n && arr1[j] != i){
- j++;
- }
- if (j == n)
- cout << i;
- // cout << i << "\t";}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement