二维数组中行最大值中的最小值

来源:互联网 发布:linux查看目录 编辑:程序博客网 时间:2024/05/21 09:32
#include<iostream>#include<vector>#include<list>#include<set>#include<algorithm>using namespace std;int main(){    int max,min;    int  a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };    for (int i = 0; i < 3; i++)    {        for (int j = 0; j < 4; j++)        {            cout << a[i][j] << "\t";        }        cout << endl;    }    for (int i = 0; i < 3; i++)    {        max = a[i][0];        for (int j = 0; j < 4; j++)        {            if (max < a[i][j]);            max = a[i][j];        }        if (i == 0)            min = max;        else        {            if (min > max)                min = max;        }        cout << min << endl;    }    system("pause");    return 0;}
0 0
原创粉丝点击