в массиве к(5,10) найти минимальный элемент массива
не в Паскале.
Приложения:
rus10011111:
На Java пойдет?
Ответы
Ответ дал:
0
#include "stdafx.h"
#include <iostream>
#include <ctime>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
setlocale(LC_ALL,"RUS");
int mas[5][10];
srand(time(NULL));
for (int i=0;i<5; i++)
{
for (int j=0; j<10;j++)
{
mas[i][j]=-50 + rand() % 99;
}
} int min=mas[0][0];
for (int i=0;i<5; i++)
for (int j=0; j<10;j++)
{
if (mas[i][j]<min){ min=mas[i][j]; }
}
cout <<"Минимальний элемент="<<min<<endl;
system("pause");
return 0;
}
#include <iostream>
#include <ctime>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
setlocale(LC_ALL,"RUS");
int mas[5][10];
srand(time(NULL));
for (int i=0;i<5; i++)
{
for (int j=0; j<10;j++)
{
mas[i][j]=-50 + rand() % 99;
}
} int min=mas[0][0];
for (int i=0;i<5; i++)
for (int j=0; j<10;j++)
{
if (mas[i][j]<min){ min=mas[i][j]; }
}
cout <<"Минимальний элемент="<<min<<endl;
system("pause");
return 0;
}
Вас заинтересует
3 месяца назад
10 месяцев назад
10 месяцев назад
1 год назад
1 год назад
7 лет назад