
Anararin
5 год назад
в массиве к(5,10) найти минимальный элемент массива не в Паскале.

ОТВЕТЫ

Светлана
Oct 24, 2020
#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;
}
199
Смежные вопросы: