N1E7R4V

Как то так

Apr 8th, 2013
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. // N4.cpp: определяет точку входа для консольного приложения.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <fstream>
  7. #include <iomanip>
  8. #include <cstdlib>
  9. #include <string>
  10. #include <sstream>
  11. #include <time.h>
  12.  
  13. using namespace std;
  14.  
  15.  
  16.  
  17. int main(int argc, _TCHAR* argv[])
  18. {  srand(time(0));
  19.     system("color 0a");
  20.     setlocale(0, "Russian");
  21.    
  22.     const int D=5;
  23.     const int H=5;
  24.     int max=-1000; //массив 5 на 5, 1000 элементов
  25.  
  26.     int array[D][H];
  27.     cout<<"Рандомный массив"<<endl; //вывод массива
  28.    
  29.    
  30.         for(int A=0;A<D;A++)
  31.         {
  32.    
  33.             for(int B=0;B<H;B++)
  34.             {
  35.                 array[A][B]=20+rand()%130;
  36.                
  37.                 cout<< setw(D)<<array[A][B];
  38.             }
  39.             cout<<"\n";
  40.         }
  41.         for(int A=0;A<D;A++)
  42.         {
  43.    
  44.             for(int B=0;B<H;B++)
  45.             {
  46.                 if(array[A][B]>max)
  47.                     max=array[A][B];
  48.             }
  49.            
  50.         }
  51.         cout<<"\n Максимальное значение:"<<max;
  52.         system("pause >> void");
  53.    
  54.     return 0;
  55.  
  56.     }
Advertisement
Add Comment
Please, Sign In to add comment