#include <iostream>
int main()
{
const int ARRAY_DIMENSION_1 = 2;
const int ARRAY_DIMENSION_2 = 6;
int buffer[ARRAY_DIMENSION_1][ARRAY_DIMENSION_2] = {};
std::cout << "Enter twelve numbers:\n";
int min;
int max;
for(int i=0; i<ARRAY_DIMENSION_1; ++i)
{
for(int j=0; j<ARRAY_DIMENSION_2; ++j)
{
std::cin >> buffer[i][j];
if(!std::cin)
{
std::cout << "Bad input\n";
return 1;
}
if(i == 0 && j == 0)
{
min = buffer[0][0];
max = buffer[0][0];
}
else
{
if(min > buffer[i][j])
{
min = buffer[i][j];
}
if(max < buffer[i][j])
{
max = buffer[i][j];
}
}
}
}
std::cout << "highest: " << max << "\nlowest: " << min << "\n";
return 0;
}
Comments
Leave a comment