Advertisement
SeriousVenom

Untitled

Dec 16th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. // Semakin340B8.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
  2. //
  3.  
  4. #include "pch.h"
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     const int n=10;
  12.     int a[n];
  13.     for (int i = 0; i < n; i++)
  14.     {
  15.         cout << "Enter elements: ";
  16.         cin >> a[i];
  17.     }
  18.     cout << "Array: " << endl;
  19.     for (int i=0; i < n; i++)
  20.  
  21.         cout << a[i] << " "; cout << endl;
  22.         int max = a[0];
  23.         for (int i=0; i < n; i++)
  24.         {
  25.             if (a[i] > max)
  26.             {   max = a[i];
  27.         }
  28.         }
  29.        
  30.         cout << "Max: " << max << endl;
  31.         for (int i=0; i < n; i++)
  32.         {if (a[i]==max)
  33.         {
  34.             a[i] = 0;
  35.             break;
  36.         }
  37.         }
  38.  
  39.         cout << "New" << endl;
  40.         for (int i=0; i < n; i++) cout << a[i] << " ";
  41.  
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement