当前位置:网站首页>C学生管理系统 据学号查找学生节点
C学生管理系统 据学号查找学生节点
2022-08-05 02:05:00 【joker_0030】
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
//学生节点。
typedef struct _STU
{
char arrStuNum[10];
char arrStuName[10];
int iStuScore;
struct _STU* pNext;//指向下一个节点。
}STUNODE;
//申明链表的头和尾。
STUNODE* g_pHead = NULL;
STUNODE* g_pEnd = NULL;
//查找指定位置学生信息。
STUNODE* FindStuByNum(char* arrStuNum);
int main()
{
int nOrder = -1;
char arrStuNum[10] = { '\0' };
char arrStuName[10] = { '\0' };
int iStuScore = -1;
int nFlag = 1;
//显示指令。
ShowOrder();
while (nFlag)
{
printf("请输入操作指令(0为查看指令)\n");
scanf("%d", &nOrder);
switch (nOrder)
{
case 1://添加一个学生信息。
printf("输入学号:");
scanf("%s", arrStuNum);
printf("输入姓名:");
scanf("%s", arrStuName);
printf("输入分数:");
scanf("%d", &iStuScore);//取地址。
AddStuMSG(arrStuNum, arrStuName, iStuScore);
break;
case 10://头添加。
printf("输入学号:");
scanf("%s", arrStuNum);
printf("输入姓名:");
scanf("%s", arrStuName);
printf("输入分数:");
scanf("%d", &iStuScore);//取地址。
AddStuMSGToLinkHead(arrStuNum, arrStuName, iStuScore);
break;
case 11://指定位置添加。
printf("输入需要查找的学号:");
scanf("%s", arrStuNum);
if (NULL != FindStuByNum(arrStuNum));
{
//插入。
}
break;
case 2:
printf("请输入学生学号/姓名");
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8://打印数据(链表)。
ShowStuData();
break;
case 9:
nFlag = 0;
break;
case 0:
//查看指令。
ShowOrder();
break;
default:
printf("输入的指令不对");
break;
}
}
//释放链表。
FreeLinkData();
system("pause");
return 0;
}
STUNODE* FindStuByNum(char* arrStuNum)
{
STUNODE* pTemp = g_pHead;
//检测参数的合法性。
if (NULL == arrStuNum)
{
printf("学号输入错误!\n");
return NULL;
}
//判断链表是否为空。
if (NULL == g_pHead || NULL == g_pEnd)
{
printf("链表为NULL!\n");
return NULL;
}
//遍历链表。
while (pTemp != NULL)
{
if (0 == strcmp(pTemp->arrStuNum, arrStuNum))
{
return pTemp;
}
pTemp = pTemp->pNext;
}
printf("查无此节点!\n");
return NULL;
}
边栏推荐
- 2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
- 力扣-二叉树的前序遍历、中序遍历、后序遍历
- MySQL learning
- 线性表的查找
- [How to smash wool according to the music the couple listens to during the Qixi Festival] Does the background music affect the couple's choice of wine?
- 开篇-开启全新的.NET现代应用开发体验
- Live preview | 30 minutes started quickly!Look at credible distributed AI chain oar architectural design
- 如何创建rpm包
- MySQL学习
- 意识形态的机制
猜你喜欢
Live playback including PPT download | Build Online Deep Learning based on Flink & DeepRec
迁移学习——Distant Domain Transfer Learning
LPQ(局部相位量化)学习笔记
缺陷检测(图像处理部分)
How to simply implement the quantization and compression of the model based on the OpenVINO POT tool
为什么他们选择和AI恋爱?
Simple implementation of YOLOv7 pre-training model deployment based on OpenVINO toolkit
记录谷歌gn编译时碰到的一个错误“I could not find a “.gn“ file ...”
树形查找(二叉查找树)
ExcelPatternTool: Excel表格-数据库互导工具
随机推荐
day14--postman接口测试
IJCAI2022 | DictBert:采用对比学习的字典描述知识增强的预训练语言模型
Greenplum Database Fault Analysis - Why Does gpstart -a Return Failure After Version Upgrade?
EBS利用虚拟列及hint 提示优化sql案例一则
关于#sql shell#的问题,如何解决?
Opencv - video frame skipping processing
Leetcode brushing questions - 22. Bracket generation
[Word] #() error occurs after Word formula is exported to PDF
leetcode-另一棵树的子树
Leetcode刷题——22. 括号生成
Hypervisor related knowledge points
没有对象的程序员如何过七夕
How to create an rpm package
如何基于OpenVINO POT工具简单实现对模型的量化压缩
HOG feature study notes
刷爆朋友圈,Alibaba出品亿级并发设计速成笔记太香了
转:查尔斯·汉迪:你是谁,比你做什么更重要
编译预处理等细节
如何创建rpm包
Is DDOS attack really unsolvable?Do not!