当前位置:网站首页>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;
}
边栏推荐
- leetcode-另一棵树的子树
- [Word] #() error occurs after Word formula is exported to PDF
- C语言基础知识 -- 指针
- 【Word】Word公式导出PDF后出现井号括号#()错误
- std::string::find 返回值的坑
- Three handshake and four wave in tcp
- iNFTnews | What can NFTs bring to the sports industry and fans?
- HOG特征学习笔记
- 亚马逊云科技 + 英特尔 + 中科创达为行业客户构建 AIoT 平台
- day14--postman接口测试
猜你喜欢

“嘀哩哩,等灯等灯”,工厂安全生产的提示音

Method Overriding and Object Class

《.NET物联网从零开始》系列
![[Machine Learning] 21-day Challenge Study Notes (2)](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[Machine Learning] 21-day Challenge Study Notes (2)
![[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?](/img/eb/535ffaff9b535fbc73a4d56aab0b3a.png)
[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?

直播回放含 PPT 下载|基于 Flink & DeepRec 构建 Online Deep Learning

一文看懂推荐系统:召回06:双塔模型——模型结构、训练方法,召回模型是后期融合特征,排序模型是前期融合特征

【MySQL系列】- LIKE查询 以%开头一定会让索引失效吗

MySQL learning

开篇-开启全新的.NET现代应用开发体验
随机推荐
迁移学习——Distant Domain Transfer Learning
短域名绕过及xss相关知识
The difference between a process in user mode and kernel mode [exclusive analysis]
编译预处理等细节
Fragment visibility judgment
2022 EdgeX中国挑战赛8月3日即将盛大开幕
基于OpenVINO工具套件简单实现YOLOv7预训练模型的部署
第09章 性能分析工具的使用【2.索引及调优篇】【MySQL高级】
缺陷检测(图像处理部分)
How to deal with your own shame
Object.defineProperty实时监听数据变化并更新页面
迁移学习——Joint Geometrical and Statistical Alignment for Visual Domain Adaptation
SuperMap iDesktop.Net之布尔运算求交——修复含拓扑错误复杂模型
高数_复习_第1章:函数、极限、连续
Methods commonly used interface automation test framework postman tests
[Word] #() error occurs after Word formula is exported to PDF
Use of pytorch: Convolutional Neural Network Module
<开发>实用工具
oracle将restful接口封装到视图中
记录谷歌gn编译时碰到的一个错误“I could not find a “.gn“ file ...”