当前位置:网站首页>C student management system Find student nodes based on student ID
C student management system Find student nodes based on student ID
2022-08-05 02:19: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;
//Find student information at a given location.
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("Enter the student number you want to find:");
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;
}
边栏推荐
- Exploding the circle of friends, Alibaba produced billion-level concurrent design quick notes are too fragrant
- 【日常训练】1403. 非递增顺序的最小子序列
- 如何基于OpenVINO POT工具简单实现对模型的量化压缩
- iNFTnews | 对体育行业和球迷来说,NFT可以带来什么?
- 【解密】OpenSea免费创造的NFT都没上链竟能出现在我的钱包里?
- EBS uses virtual columns and hint hints to optimize sql case
- KingbaseES V8 GIS data migration solution (2. Introduction to the capabilities of Kingbase GIS)
- 转:查尔斯·汉迪:你是谁,比你做什么更重要
- PHP技能评测
- C语言日记 9 if的3种语句
猜你喜欢
英特尔 XDC 2022 精彩回顾:共建开放生态,释放“基建”潜能
Optimizing the feed flow encountered obstacles, who helped Baidu break the "memory wall"?
LeetCode uses the minimum cost to climb the stairs----dp problem
Pisanix v0.2.0 发布|新增动态读写分离支持
<开发>实用工具
优化Feed流遭遇拦路虎,是谁帮百度打破了“内存墙”?
学习笔记-----左偏树
线性表的查找
如何基于OpenVINO POT工具简单实现对模型的量化压缩
LPQ(局部相位量化)学习笔记
随机推荐
Apache DolphinScheduler新一代分布式工作流任务调度平台实战-中
<开发>实用工具
ARM Mailbox
02 【开发服务器 资源模块】
js中try...catch和finally的用法
the mechanism of ideology
leetcode-对称二叉树
ExcelPatternTool: Excel table-database mutual import tool
Flink 1.15.1 集群搭建(StandaloneSession)
进程在用户态和内核态的区别[独家解析]
直播预告|30分钟快速入门!来看可信分布式AI链桨的架构设计
[LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)
01 [Foreword Basic Use Core Concepts]
EBS利用虚拟列及hint 提示优化sql案例一则
[Word] #() error occurs after Word formula is exported to PDF
Unleashing the engine of technological innovation, Intel joins hands with ecological partners to promote the vigorous development of smart retail
Pisanix v0.2.0 发布|新增动态读写分离支持
Leetcode刷题——22. 括号生成
Programmer's list of sheep counting when insomnia | Daily anecdote
Matlab map with color representation module value size arrow