0

how i can but maximum number in function for this program.

#include <iostream> using namespace std; void printMatrix(int matrix[2][2]){ for(int i=0;i<2;i++) { for(int j=0;j<2;j++) { cout<<matrix[i][j]<<" "; } cout<<endl; } } int main() { int matrix[2][2]={{4,8},{12,16}}; printMatrix(matrix); system("pause"); }

24th Jul 2017, 9:21 AM
sa_kh_20
9 Antworten
+ 2
May be its typing error i dont know...but i take your question as "how i can put max. numbers in function in this program" my answer is just increase your function accepting array size and also increase the value which u are goin to pass.....hope u understand....
24th Jul 2017, 10:30 AM
Shreyas Subhedar
Shreyas Subhedar - avatar
+ 2
Ok gotcha.. writie this code like this one:- int i, temp=0; for(i=0;i<n;i++) { for(j=0;j<n;j++) { if(temp>>a[i][j]) temp=a[i]; } } //here n=size of array... hope it'll help.....
24th Jul 2017, 11:07 AM
Shreyas Subhedar
Shreyas Subhedar - avatar
+ 1
good ans shreyas subhedar
24th Jul 2017, 10:31 AM
Jerin Ignatious
Jerin Ignatious - avatar
+ 1
Ok thank you But I want the if statement in function. So that the larger value of the matrix is ​​extracted
24th Jul 2017, 10:34 AM
sa_kh_20
+ 1
nice code shreyas subhedar!!!! keep it up
24th Jul 2017, 11:08 AM
Jerin Ignatious
Jerin Ignatious - avatar
+ 1
sahi re bhava @shreyas
24th Jul 2017, 11:08 AM
saurabh sable
saurabh sable - avatar
+ 1
Thanks Jerin and Saurabh ..... im glad that u like mah work yo!!!!
24th Jul 2017, 11:10 AM
Shreyas Subhedar
Shreyas Subhedar - avatar
+ 1
see you today guys ;p
24th Jul 2017, 11:10 AM
saurabh sable
saurabh sable - avatar
+ 1
vishay ka bhava!!! ;-)
24th Jul 2017, 11:11 AM
Jerin Ignatious
Jerin Ignatious - avatar