//it outputs max is 0 ,can anyone show whats the error?thanks..
#include<iostream>
using namespace std;
int main()
{
int mid ;
int data[4][4]={{3,6,7,7},{7,5,4,4},{8,7,9,6},{5,7,3,1}};
int max;
cout<<"Enter the Module number to grt thr highest scored student"<<endl;
cin>>mid;
for(int a=1;a<4;a++)
{
max== data[0][mid];
if (max<data[a][mid])
max==data[a][mid];
}
cout<<"max is "<<max<<endl;
Line 14, 16: You're using the comparison operator, not the assignment operator. These statements have no effect.
Line 15: max is uninitialized because of the previous error.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/