//KT giua ki cau 3
#include <iostream>
#include <iomanip>
using namespace std;
int rowMax(int a[][10], int hang, int cot,int sohang)
{
int max = a[sohang-1][0];
for(int j = 0; j < cot; j++)
{
a[sohang-1][j] > max;
max = a[sohang-1][j];
}
return max;
}
int colMin(int a[][10], int hang, int cot,int socot)
{
int min;
for(int i = 0; i < hang; i++)
{
min = a[0][socot-1];
a[i][socot-1] < min;
min = a[i][socot-1];
}
return min;
}
int main()
{
int a[10][10];
int hang, cot;
cout << "Nhap so hang: ";
cin >> hang;
cout << "Nhap so cot: ";
cin >> cot;
cout << "Nhap phan tu ma tran: " << endl;
for(int i = 0; i < hang; i++)
for(int j = 0; j < cot; j++)
cin >> a[i][j];
cout << "Ma tran vua nhap: " << endl;
for(int i = 0; i < hang; i++)
{
for(int j = 0; j < cot; j++)
cout << setw(2) << a[i][j];
cout << endl;
}
int sohang;
cout << "Nhap so hang muon tim Max: ";
cin >> sohang;
cout << "Max dong: " << rowMax(a,hang,cot,sohang);
cout << endl;
int socot;
cout << "Nhap so cot muon tim Min: ";
cin >> socot;
cout << "Min cot: " << colMin(a,hang,cot,socot);
}
Không hiểu sao chạy kết quả sai.Sữa lỗi giúp mình với ạ