C语言高手帮帮忙!~(急急急)

来源:百度知道 编辑:UC知道 时间:2024/05/30 01:21:12
#include <stdio.h>
int count=0;
struct student
{
int num;
char name[20];
float score[3];
float pscore;
};
struct student stu[50];
void st(struct student *p)
{
int i;
float sum=0;
printf("\n学号: ");
scanf("%d",&p->num);
printf("\n姓名: ");
fflush(stdin);
gets(p->name);
printf("三门成绩:\n");
for (i=0;i<3;i++)
{
printf("成绩%d: ",i+1);
scanf("%f",&p->score[i]);
sum+=p->score[i];
printf("\n");
}
p->pscore =sum/3;
}
void paixu(struct student stu[],int count);
void put(struct student stu[],int count);
void charu(struct student stu[],int count);
void shanchu(struct student stu[],int count);
//主函数
void main()
{

int i=0;
char k='y';
int count=0;
do

这个问题很简单的,因为你定义了全局变量,而在插入与删除函数中,又出现了局部变量,所以不论你这么调用这些函数。全局变量总是不会变化,所以你的操作总是失败。
在插入删除函数的参数中,将count参数取消即可。
建议你写程序时尽量不要用全局变量。

自己想办法才有练习效果