问题请教!!!!!急
请各位大神帮我看一下程序哪里出问题了总是用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={{85,59, 86,79,58 },{99,87,85,92,96},{88,69,58,82,58},{88,86,85,92,84}};
char stu={"001","002","003","004","005"};
int *stu_score;
char *stu_num;
int *stu3_score;
char *stu3_num;
int *stu4_score;
char *stu4_num;
int i;
for(i=0;i<4;i++)
{
stu_score=&a;
stu3_score=&a;
stu4_score=&a;
stu_num=stu_num;
stu3_num=stu_num;
stu4_num=stu_num;
}
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;
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+j)<60)
k++;
}
if(k>=2)
{
cout<<"成绩有两门不及格的同学有 ; "<<endl;
//cout<<num1<<" ";
for(j=0;j<5;j++)
cout<<*(p1+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+j);
if(*(p2+j)>=85)
k++;
}
if((sum==(90*5))||k==5)
{
cout<<"成绩优秀的同学有: "<<endl;
cout<<num2;
cout<<" ";
for(j=0;j<5;j++)
cout<<*(p2+j)<<" ";
cout<<endl;
}
}
cout<<"*************************************************************"<<endl;
return 0;
}
页:
[1]