C语言链表学生信息管理系统

之前大一写的,一年前的水平
现在学习数据结构,重新拿出来看看

分享给大家看看



#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
#include<conio.h>
#include<ctype.h>
#define Esc 27
#define NULL 0
#define LEN sizeof(struct student)
struct student
{
	char class_0[20];					//班级
	int num;							//学号
	char name[20];						//姓名
	float c_prog;						//c语言程序设计
	float eng;							//大学英语
	float math;							//高等数学
	float avg;							//平均成绩
	int order;							//名次
	struct student *next;
};
int n;									//全局变量,统计学生记录的个数
//函数声明
struct student *create();
void Output(struct student *head);
struct student *Delete(struct student *head, int num);
struct student *insert(struct student *head, struct student *stud);
struct student *Lookup(struct student *head, int num);
struct student *Modify(struct student *head, int num);
float Statistic(struct student *p);
struct student *order(struct student *head);
void start();
void goon();
void exit();
//创建链表,输入学生信息
struct student *create()
{
	struct student *head;
	struct student *pl;
	n=0;
	pl=(struct student*) malloc(LEN);
	printf("\n\n\t请输入学生的信息:  \n");
	printf("\t输入格式为:(每输入一项回车,以学号为0退出!)\n");
	printf("\t请输入学生学号:");
	scanf("%d",&pl->num );
	printf("\t请输入学生姓名:");
	scanf("%s",&pl->name );
	printf("\t请输入学生班级:");
	scanf("%s",&pl->class_0 );
	printf("\n");
	printf("\t请输入程序设计成绩:");
	scanf("%f",&pl->c_prog );
	printf("\t请输入大学英语成绩:");
	scanf("%f",&pl->eng );
	printf("\t请输入高等数学成绩:");
	scanf("%f",&pl->math );
	printf("\n");
	head=NULL;
	while(pl->num !=0)
	{
		pl->avg =Statistic(pl);			//求pl的平均值
		head=insert(head,pl);			//创建链表
		pl=(struct student*)malloc(LEN);
		printf("\n\t如果你想结束输入,请输入 0 !\n\n");
		printf("\t请输入学号:");
		scanf("%d",&pl->num );
		if(pl->
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值