河南成教 / C 语言程序设计
[程序题]
编写程序,计算学生的平均成绩并统计不及格的人数。部分程序如下:
#include
struct stu
{
int num;
char*name;
char sex;
float score;
}student[5]={
{101,"Li ping",'M',45},
{102,"Zhang ping",'M',62.5},
{103,"He fang",'F',92.5},
{104,"Cheng ling",'F',87},
{105,"Wang ming",'M',58},
};
void main()
{
int i,c=0;
float ave,s=0;
for(i=0;i<5;i )
{
s = ( ) ;
if( )
c ;
}
( )
printf("%.2f %d",ave,c);
return 0;
}
[程序题]
编写程序,计算学生的平均成绩并统计不及格的人数。部分程序如下:
#include
struct stu
{
int num;
char*name;
char sex;
float score;
}student[5]={
{101,"Li ping",'M',45},
{102,"Zhang ping",'M',62.5},
{103,"He fang",'F',92.5},
{104,"Cheng ling",'F',87},
{105,"Wang ming",'M',58},
};
void main()
{
int i,c=0;
float ave,s=0;
for(i=0;i<5;i )
{
s = ( ) ;
if( )
c ;
}
( )
printf("%.2f %d",ave,c);
return 0;
}
参考答案:
佳题速递: