请问一下问题在哪里,我用DEV-C++,编译通过,但看不到结果?!
#include <iostream>
using namespace std;
void input(int a[][3],int&n){
cout < < "please input student state " < <endl;
for(int i=0;i!=n;i++){
int tmp;
cout < < "Input school NO " < <ends;
cin> > tmp;
a[i][0]=tmp;
cout < < "Input school score " < <ends;
cin> > tmp;
a[i][1]=tmp;
}
}
void comp(int a[][3],int n){
int sum=0;
int equl=0;
for(int i=0;i!=n;i++)
sum+=a[i][1];
equl=sum/n;
for(int j=0;j!=n;j++){
double level=0.0;
level=(a[j][1]-equl)/equl;
if(level> 0.2)
a[j][2]=1;
else
{if(level> 0.15&&level <0.2)
a[j][2]=2;
else
{if(level> 0.1&&level <0.15)
a[j][2]=3;
}
}
}
}
void disp(int a[][3],int n){
for(int i=0;i!=n;i++){
if(a[i][2]==1)
cout < < "this is the NO one " < <endl;
else
{if(a[i][2]==2)
cout < < "this is the NO two " < <endl;
else
{if(a[i][2]==3)
cout < < "this is the NO three " < <endl;
else
;
}
}
}
}
int main()
{
int a[10][3];
int n=0;
cin> > n;
input(a,n);
comp(a,n);
disp(a,n);
}
[解决办法]
level=(a[j][1]-equl)/equl;
==》
level=(double)(a[j][1]-equl)/equl;