当前位置:网站首页>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;
}
边栏推荐
- Transfer Learning - Joint Geometrical and Statistical Alignment for Visual Domain Adaptation
- XMjs跨域问题解决
- source program in assembly language
- 力扣-二叉树的最大的深度
- Programmer's list of sheep counting when insomnia | Daily anecdote
- the mechanism of ideology
- 亚马逊云科技携手中科创达为行业客户构建AIoT平台
- 缺陷检测(图像处理部分)
- sql语句多字段多个值如何进行排序
- SuperMap支持的国产环境汇总
猜你喜欢

Use of pytorch: Convolutional Neural Network Module

浅谈数据安全治理与隐私计算

ExcelPatternTool: Excel table-database mutual import tool

source program in assembly language

2022 EdgeX中国挑战赛8月3日即将盛大开幕

(17) 51 MCU - AD/DA conversion

关于#sql shell#的问题,如何解决?

如何逐步执行数据风险评估

Understand the recommendation system in one article: Recall 06: Two-tower model - model structure, training method, the recall model is a late fusion feature, and the sorting model is an early fusion

程序员失眠时的数羊列表 | 每日趣闻
随机推荐
如何逐步执行数据风险评估
直播回放含 PPT 下载|基于 Flink & DeepRec 构建 Online Deep Learning
[parameters of PyQT5 binding functions]
Dotnet 6 Why does the network request not follow the change of the system network proxy and dynamically switch the proxy?
亚马逊云科技 + 英特尔 + 中科创达为行业客户构建 AIoT 平台
使用SuperMap iDesktopX数据迁移工具迁移ArcGIS数据
"Configuration" is a double-edged sword, it will take you to understand various configuration methods
1349. 参加考试的最大学生数 状态压缩
优化Feed流遭遇拦路虎,是谁帮百度打破了“内存墙”?
用@Mapper查询oracle的分区情况报错
【MySQL series】- Does LIKE query start with % will make the index invalid?
Greenplum数据库故障分析——能对数据库base文件夹进行软连接嘛?
How to simply implement the quantization and compression of the model based on the OpenVINO POT tool
Transfer Learning - Distant Domain Transfer Learning
2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
HOG特征学习笔记
Log an error encountered when compiling google gn "I could not find a ".gn" file ..."
Chapter 09 Use of Performance Analysis Tools [2. Index and Tuning] [MySQL Advanced]
超越YOLO5-Face | YOLO-FaceV2正式开源Trick+学术点拉满
A new technical director, who calls DDD a senior, is convinced