当前位置:网站首页>C 学生管理系统_添加学生
C 学生管理系统_添加学生
2022-08-04 00:38:00 【joker_0030】
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
//学生节点。
typedef struct _STU
{
char arrStuNum[10];
char arrStuName[10];
int iStuScore;
struct _STU* pNext;//指向下一个节点。
}STUNODE;
//申明链表的头和尾。
STUNODE* g_pHead = NULL;
STUNODE* g_pEnd = NULL;
void AddStuMSG(char* arrStuNum[10], char srrStuName[10], int iStuScore);
int main()
{
int nOrder=-1;
char arrStuNum[10] = {'\0'};
char arrStuName[10] = {'\0'};
int iStuScore=-1;
printf("*******************学生管理系统******************\n");
printf("******************系统操作指令如下****************\n");
printf("***1、增加一个学生信息***\n");
printf("***2、查找指定学生信息(姓名/学号)***\n");
printf("***3、修改指定学生的信息***\n");
printf("***4、保存业主的信息到文件***\n");
printf("***5、读取文件中的业主信息***\n");
printf("***6、删除指定学生的信息***\n");
printf("***7、恢复删除的学生信息***\n");
printf("***8、显示所有学生信息***\n");
printf("***9、退出系统***\n");
printf("*****************************************************\n");
scanf("%d", &nOrder);
switch (nOrder)
{
case 1:
printf("输入学号:");
scanf("%s", arrStuNum);
printf("输入姓名:");
scanf("%s", arrStuName);
printf("输入分数:");
scanf("%d", &iStuScore);//取地址。
void AddStuMSG(char* arrStuNum[10], char arrStuName[10], int iStuScore);
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
default:
printf("输入的指令不对");
break;
}
system("pause");
return 0;
}
//添加一个学生信息。
void AddStuMSG(char *arrStuNum[10], char arrStuName[10], int iStuScore)
{
//逻辑
//创建一个节点。
STUNODE* pTemp = malloc(sizeof(STUNODE));
//第一步,检验参数合法性。
if (NULL==arrStuNum||NULL==arrStuName||iStuScore<0)
{
printf("学生信息输入错误。\n");
return;
}
//节点成员赋初始值。
strcpy(pTemp->arrStuNum, arrStuNum);//因为数组做参数传入时则完全是一个指针。
strcpy(pTemp->arrStuName, arrStuName);//因为数组做参数传入时则完全是一个指针。
pTemp->iStuScore = iStuScore;
pTemp->pNext = NULL;
//接在链表上。
if (NULL == g_pHead || NULL == g_pEnd)
{
g_pHead = pTemp;
g_pEnd = pTemp;
}
else
{
g_pEnd->pNext = pTemp;//链接。
g_pEnd = pTemp;//向后移动。
}
}
边栏推荐
- 小米--测试开发
- typescript51-泛型的基本使用
- LeetCode第三题(Longest Substring Without Repeating Characters)三部曲之三:两次优化
- Justin Sun was invited to attend the 36氪 Yuan Universe Summit and delivered a keynote speech
- boot issue
- 孙宇晨:Web3.0和元宇宙将协助人类更加全面地进入网络世界
- Install third-party packages via whl
- 手撕Nacos源码,今日撕服务端源码
- Electronics manufacturing enterprise deployment WMS what are the benefits of warehouse management system
- typescript48 - type compatibility between functions
猜你喜欢

typescript54 - generic constraints

研究生新生培训第四周:MobileNetV1, V2, V3

第1章:初识数据库与MySQL----MySQL安装

【性能优化】MySQL常用慢查询分析工具

因为一次bug的教训,我决定手撕Nacos源码(先撕客户端源码)

typescript50 - type specification between cross types and interfaces

js函数防抖和函数节流及其使用场景

互斥锁、读写锁、自旋锁,以及原子操作指令xaddl、cmpxchg的使用场景剖析

【超详细教程】LVS+KeepAlived高可用部署实战应用

Read FastDFS in one article
随机推荐
迭代扩展卡尔曼滤波IEKF
2022-08-03: What does the following go code output?A: 2; B: 3; C: 1; D: 0.package main import "fmt" func main() { slice := []i
LeetCode 19:删除链表的倒数第 N 个结点
虚拟机CentOS7中无图形界面安装Oracle
The Beijing E-sports Metaverse Forum was successfully held
typescript56 - generic interface
Vant3 - click on the corresponding name name to jump to the next page corresponding to the location of the name of the TAB bar
浅谈我国产业园区未来的发展方向
Spinnaker调用Jenkins API 返回403错误
LeetCode third topic (the Longest Substring Without Repeating Characters) trilogy # 3: two optimization
Jmeter cross-platform operation CSV files
typescript50 - type specification between cross types and interfaces
typescript58-泛型类
第1章:初识数据库与MySQL----MySQL安装
LeetCode第三题(Longest Substring Without Repeating Characters)三部曲之三:两次优化
Demand analysis of MES management system in electronic assembly industry
[Miscellaneous] How to install the specified font into the computer and then use the font in the Office software?
LeetCode第三题(Longest Substring Without Repeating Characters)三部曲之三:两次优化
Google Earth Engine ——利用公开的河流数据计算河流的有效宽度
A Preliminary Study of RSS Subscription to WeChat Official Account-feed43