srand(time(0));
const int size = 20;
int A[size]{};
for (size_t i = 0; i < size; i++)
{
cout << endl;
int min = A[0];
int max = A[0];
int index_min = 0;
int index_max = 0;
for (size_t i = 0; i < size; i++)
{
}
cout << "Min: " << "A[" << index_min << "]= " << min << endl
const int size = 20;
int A[size]{};
for (size_t i = 0; i < size; i++)
{
A[i] = rand() % 101;}
cout << A[i] << " ";
cout << endl;
int min = A[0];
int max = A[0];
int index_min = 0;
int index_max = 0;
for (size_t i = 0; i < size; i++)
{
if (A[i] <= min)
{
min = A[i];}
index_min = i;
if (A[i] >= max)
{
max = A[i];}
index_max = i;
}
cout << "Min: " << "A[" << index_min << "]= " << min << endl
<< "Max: " << "A[" << index_max << "]= " << max << endl;system("pause");
Комментариев нет:
Отправить комментарий