c语言学生管理系统代码

#include "student_mag.h"




int main()
{
	Node* head = malloc(sizeof(Node));
	head->next = NULL;
	while (1)
	{
		welcome();

		char ch = _getch();

		switch (ch)
		{
		case '1':
			Inputstudent(head);  //录入学生信息
			break;
		case '2':
			Printstudent(head);  //打印学生信息
			break;
		case '3':
			Countstudent(head);  //统计学生信息
			break;
		case '4':
			Findstudent(head);  //查找学生信息
			break;
		case '5':
			break;
		case '6':
			break;
		case '7':
			break;
		default:
			break;

		}
	}
	

	return 0;
}

void Inputstudent(Node* head)  //输入学生信息
{
	Node* fresh = malloc(sizeof(Node));
	fresh->next = NULL;
	printf("请输入学生信息\n");
	scanf("%d%s%d", &fresh->stu.num, fresh->stu.name, &fresh->stu.sorce);
	Node* move = head;
	while (move->next!=NULL)
	{
	  move = move->next;
	}
	move->next = fresh;

	system("pause");
	system("cls");

}

void Printstudent(Node* head)
{
	Node* move = head->next;
	while (move!=NULL)
	{  
		printf("学号:%d,姓名:%s,分数:%d\n", move->stu.num, move->stu.name, move->stu.sorce);
		move = move->next;
	}
	system("pause");
	system("cls");
}

void Countstudent(Node* head)
{   
	int count = 0;
	Node* move = head->next;
	while (move!=NULL)
	{
		count++;
		move = move->next;
	}
	printf("学生人数为%d\n", count);
	system("pause");
	system("cls");
}
void Findstudent(Node* head)
{   
	printf("请输入学生学号:");
	int stunum;
	scanf("%d", &stunum);
	Node* move = head->next;
	while (move!=NULL)
	{
		if (stunum == move->stu.num)
		{
			printf("学号:%d,姓名:%s,成绩%d\n", move->stu.num, move->stu.name, move->stu.sorce);
			system("pause");
			system("cls");
			return;
		}
		move = move->next;
	}
	printf("未找到学生\n");
	system("pause");
	system("cls");
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

年*D-清仁

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值