毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 课程设计 >> 正文

成绩管理系统 第2页

更新时间:2007-10-20:  来源:毕业论文

 

void insert_func(void) //一插入就比较字符串(2 2想比较很简单) 不是等到全部插完了才比较
{
char s_temp[4];
ptr=(struct student *) malloc(sizeof(struct student));
printf(" Student name : ");
gets(ptr->name);
printf(" Student score: ");
gets(s_temp);
ptr->score = atoi(s_temp);//把字符串转化为 整数  为什么不直接把成绩存在ptr->score ???

sort_func();
}

/*以分数高低由大到小排列*/
void sort_func(void)
{
//插入数据
prev = head;
current = head->next;
while ((current != NULL) && (current->score > ptr->score))
{
prev = current;
current = current->next;
}
ptr->next = current;
prev->next = ptr;
}

void delete_func(void)
{
char del_name[20];
printf(" Delete student name: ");
gets(del_name);

prev = head;
current = head->next;
while ((current != NULL) && (strcmp(current->name , del_name)!=0))//用到了strcmp 比较字符串
{
prev = current;
current = current->next;
}
if (current != NULL)
{
prev->next = current->next;
free(current);
printf(" %s student record deleted\n",del_name);
}
else
printf(" Student %s not found\n",del_name);

anykey_func();
}

void modify_func(void)
{
char n_temp[20],s_temp[4];
printf(" Modify student name: ");
gets(n_temp);//这样输入姓名
current=head->next;

while ((current != NULL) && (strcmp(current->name , n_temp)!=0))
{
prev = current;
current = current->next;
}
if (current != NULL)
{
printf(" **************************\n");
printf("  Student name : %s\n",current->name);
printf("  Student score: %d\n",current->score);
printf(" **************************\n");
printf(" Please enter new score: ");
gets(s_temp);
current->score = atoi(s_temp);
printf(" %s student record modified\n",n_temp);
}
else
printf(" Student %s not found\n",n_temp);

anykey_func();
}

void display_func(void)
{
int count=0;
system("cls");
if(head->next == NULL)
{
printf(" No student record\n");
}
else
{
printf("  NAME                SCORE\n");
printf(" ---------------------------\n");
current=head->next;
while(current != NULL)
{
printf("  %-20s %3d\n", current->name, current->score);
count++;
current=current->next;
if(count % 20 == 0) getch();
}
printf(" ---------------------------\n");
printf(" Total %d record(s) found\n", count);
}
anykey_func();
}

void anykey_func(void)//任何键继续
{
printf(" Press any key to continue...");
getch();
printf("\n");
}

上一页  [1] [2] 

成绩管理系统 第2页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。