TheRasVa

Задача 5,7

Apr 10th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4. int mas_size = 0;
  5.  
  6. long long mas_max(long long mas[])
  7. {
  8.     long long max, i = 0;
  9.     max = mas[0];
  10.     while (i < mas_size)
  11.     {
  12.         if (max < mas[i])
  13.         {
  14.             max = mas[i];
  15.         }
  16.         i++;
  17.     }
  18.     return max;
  19. }
  20.  
  21.  
  22. int main()
  23. {
  24.     long long mas[10000];
  25.     setlocale(LC_ALL, "russian");
  26.     system("color 0A");
  27.     cout << "Введите массив (0 -- остановиться): " << endl;
  28.     do
  29.     {
  30.         cin >> mas[mas_size];
  31.         mas_size++;
  32.     } while (mas_size < 10000 ^ mas[mas_size - 1] == 0);
  33.     cout << "Максимальное число в массиве = " << mas_max(mas) << endl;
  34.     system("pause");
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment