help

how to find maximum in only coloums in 2d array.?????
Iterate through.
what?
https://en.wikipedia.org/wiki/Iteration#Computing

I could help you more if you put in some effort (perhaps by showing what you've done so far).
Hi @muddaser,
as @Zhuge said you
have to iterate through
the 2D array i have
a little example for
you!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//2D_Array.cpp
//##

#include <iostream>
using std::cout;
using std::endl;

bool isEven(int number);

int main(){

        int const ROW=3;
        int const COL=3;
        int bd_array[ROW][COL]={{1,2,3},{4,5,6},{7,8,9}};

        cout<<"\n2D array elements"<<endl;

        //print array
        for(int i=0;i<ROW;i++){
                for(int j=0;j<COL;j++){
                        cout<<bd_array[i][j];
                }//end inner for
        cout<<endl;
        }//end outer for

        //find even numbers by column 
        cout<<"\nEven numbers by column \n\n";

        for(int k=0;k<COL;k++){
                for(int i=0;i<ROW;i++){
                                if(isEven(bd_array[i][k])){
                                        cout<<bd_array[i][k]<<" even";
                                }else{
                                        cout<<bd_array[i][k];
                                }//end if-else
                cout<<'\t';
                }//end inner for
        cout<<endl;
        }//end outer for

return 0; //indicates success
}//end of main

bool isEven(int number){
        if(number%2==0)return true;

return false;
}//end function isEven
/2D_Array 

2D array elements
123
456
789

Even numbers by column 

1	4 even	7	
2 even	5	8 even	
3	6 even	9



regards!
closed account (zybCM4Gy)
Of course, if it's an array you already know the maximum...>.>;; Perhaps he meant vectors?
The only way for him to know ahead of time is if it is a constant static (stack) array that is initialized.

Arrays can be modified during run time just like the STL containers.
Topic archived. No new replies allowed.