学生信息管理简单版本(C语言链表)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//定义两个结构体变量用于登陆界面和信息储存
struct student //学生信息
{
char name[20];
int num;
int score;
} ;
struct password //账户和密码
{
char user[20] ;
char psw ;
struct node *next ;
} ;
struct node //结构体,用于学生信息
{
struct student data ;
struct node *next ;
} ;

typedef struct User //结构体,用于登陆菜单的账户密码核对
{
char account[8] ;
char passwd[8] ;
} User ;

struct node *createlist() ; //创建链表
struct node *createnode(struct student data) ; //创建节点
void menu(struct node *list); //登陆界面函数
void readfromfile(struct node *list, const char *filename) ; //读取文件
void savetofile(struct node *list, const char *filename); //存储文件
void insertnodebyhead(struct node *list, struct student data) ; //头插法
void deletenodebyappoin(struct node *list, int num) ; //删除节点(数据)
void changeinfo(struct node *list) ; //修改信息
void sort (struct node *list) ; //根据分数排名
int Login() ; //登陆菜单函数
int main()
{
struct node list = (struct node)malloc(sizeof(struct node)) ;
list->next = NULL ; //创建链表
readfromfile(list, “studentinfo.txt”) ; //读文件,可以读取之前存储的数据
while(1) //循环,设置两个出口,登陆菜单和退出
{
system(“cls”) ;
printf("--------信息查询系统--------\n") ;
printf("----- 1登陆 -----\n") ;
printf(" 输入 0 退出并且保存文件 “) ;
putchar(10) ; //任意键跳过,10是回车键的ASCII码函数
int choice ;
scanf(”%d",&choice) ;
switch(choice)
{
case 1:
if(Login())

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值