Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // N4.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- #include <cstdlib>
- #include <string>
- #include <sstream>
- #include <time.h>
- using namespace std;
- int main(int argc, _TCHAR* argv[])
- { srand(time(0));
- system("color 0a");
- setlocale(0, "Russian");
- const int D=5;
- const int H=5;
- int max=-1000; //массив 5 на 5, 1000 элементов
- int array[D][H];
- cout<<"Рандомный массив"<<endl; //вывод массива
- for(int A=0;A<D;A++)
- {
- for(int B=0;B<H;B++)
- {
- array[A][B]=20+rand()%130;
- cout<< setw(D)<<array[A][B];
- }
- cout<<"\n";
- }
- for(int A=0;A<D;A++)
- {
- for(int B=0;B<H;B++)
- {
- if(array[A][B]>max)
- max=array[A][B];
- }
- }
- cout<<"\n Максимальное значение:"<<max;
- system("pause >> void");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment