|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
请各位大神帮我看一下程序哪里出问题了
总是用vs调试的时候弹出otream窗口!
大神求救啊!!!!!!!!!!
#include"iostream"
using namespace std;
int the_first_grade(int *p[],char *num[]);
int fail_stu(int *p1[],char *num1[]);
int high_score_stu(int *p2[],char *num2[]);
int main()
{
int a[4][5]={{85,59, 86,79,58 },{99,87,85,92,96},{88,69,58,82,58},{88,86,85,92,84}};
char stu[5][4]={"001","002","003","004","005"};
int *stu_score[5];
char *stu_num[5];
int *stu3_score[5];
char *stu3_num[5];
int *stu4_score[5];
char *stu4_num[5];
int i;
for(i=0;i<4;i++)
{
stu_score[i]=&a[i][0];
stu3_score[i]=&a[i][0];
stu4_score[i]=&a[i][0];
stu_num[i]=stu_num[i];
stu3_num[i]=stu_num[i];
stu4_num[i]=stu_num[i];
}
the_first_grade(stu_score,stu_num);
fail_stu(stu3_score,stu3_num);
high_score_stu(stu4_score,stu4_num);
return 0;
}
int the_first_grade(int *p[],char *num[])
{
cout<<"******************"<<endl;
int sum;
int i;
for(i=0,sum=0;i<4;i++)
sum+=*p[i];
cout<<"第一门的平均成绩是: "<<(sum/4)<<endl;
cout<<"******************"<<endl;
return 0;
}
int fail_stu(int *p1[],char *num1[])
{
cout<<"*************************************************************"<<endl;
int i,j,k;
for(i=0;i<4;i++)
{
for(j=0,k=0;j<5;j++)
{
if(*(p1[i]+j)<60)
k++;
}
if(k>=2)
{
cout<<"成绩有两门不及格的同学有 ; "<<endl;
//cout<<num1[i]<<" ";
for(j=0;j<5;j++)
cout<<*(p1[i]+j)<<" ";
cout<<endl;
}
}
cout<<"*************************************************************"<<endl;
return 0;
}
int high_score_stu(int *p2[],char *num2[])
{
cout<<"*************************************************************"<<endl;
int i,j,k,sum;
for(i=0;i<4;i++)
{
for(j=0,sum=0,k=0;j<5;j++)
{sum+=*(p2[i]+j);
if(*(p2[i]+j)>=85)
k++;
}
if((sum==(90*5))||k==5)
{
cout<<"成绩优秀的同学有: "<<endl;
cout<<num2[i];
cout<<" ";
for(j=0;j<5;j++)
cout<<*(p2[i]+j)<<" ";
cout<<endl;
}
}
cout<<"*************************************************************"<<endl;
return 0;
}
|
|