
Call 1800-123-2003
"Smartindia is the best online tool for school students." Ms Deepa Chandran, Principal Anchal
"Smartindia is one of the best supplementary education tool for school students." Ms Pooja, Principal
write a program to overload ++ operator for a 3x2 matrix? |
// matrix.cpp #include<iostream> int main() { int i,j,sm; int mat[3][2]; cout<<"Enter the values in the matrix:\n"; for(int i=0;i<3;i++) { for(int j=0;j<2;j++) { cin>>mat[i][j]; } } cout<<"Now print the values of the matrix:\n" ; for(int i=0;i<3;i++) { for(int j=0;j<2;j++) { cout<<"The values are :"<<"\t"<<mat[i][j]<<"\n"; } } sm=mat[0][0]; for(int i=0;i<3;i++) { for(int j=0;j<2;j++) { if(sm > mat[i][j]) sm = mat[i][j]; } } cout<<"\n Comparing we get :\n"; cout<<"The smallest number in the matrix is:\t"<<sm; return 0; } |