#include
main()
{
int a[3][4]={{1,2,7,8},{3,4,9,10},{5,6,11,12}},b[4],i,j;
for(j=0;j<4;j++)
{
b[j]=a[0][j];
for(i=0;i<3;i++)
if(a[i][j]>b[j])
b[j]=a[i][j];
}
for(i=0;i<4;i++)
printf("%d ",b[i]);
printf("\n");
}
#include
using namespace std;
int a[3][4]={{1,2,7,8},{3,4,9,10},{5,6,11,12}};
int b[4];
void f(){
int max = a[0][0];
for(int j = 0; j < 4; ++j){
for(int i = 0; i < 3; ++i){
if(max < a[i][j]){
max = a[i][j];
}
}
b[j] = max;
}
for(int i = 0; i < 4; ++i){
cout << b[i] << " ";
}
cout << endl;
}
int main(){
f(); //估计这是最简单的调用函数了
return 0;
}