当前位置:网站首页>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;//向后移动。
}
}
边栏推荐
猜你喜欢

取模运算(MOD)

"Miscellaneous" barcode by Excel as a string

通过whl安装第三方包

R3LIVE论文学习(二):VIO子系统

面试必问的HashCode技术内幕

JVM垃圾回收总结(未完待续)

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

How to find the cause of Fiori Launchpad routing errors by single-step debugging

Apple told Qualcomm: I bought a new campus for $445 million and may plan to speed up self-development of baseband chips

What warehouse management problems can WMS warehouse management system solve in the electronics industry?
随机推荐
2022年8月份DAMA-CDGA/CDGP数据治理认证招生简章
Nanoprobes Mono- Sulfo -NHS-Nanogold的使用和应用
c语言分层理解(c语言指针(上))
typescript50 - type specification between cross types and interfaces
数据库扩容也可以如此丝滑,MySQL千亿级数据生产环境扩容实战
vxe-table 从页面批量删除数据 (不动数据库里的数据)
R3LIVE论文学习(二):VIO子系统
LeetCode第三题(Longest Substring Without Repeating Characters)三部曲之三:两次优化
分析:Nomad Bridge黑客攻击的独特之处
无代码7月热讯 | 微软首推数字联络中心平台;全球黑客马拉松...
[Miscellaneous] How to install the specified font into the computer and then use the font in the Office software?
全面讲解 Handler机制原理解析 (小白必看)
dynamic memory two
Install third-party packages via whl
教你如何定位不合理的SQL?并优化之
手撕Nacos源码,今日撕服务端源码
win10+cuda11.7+pytorch1.12.0 installation
【每日一题】899. 有序队列
It will invest about 200 billion US dollars in the United States in 20 years, and Samsung Electronics looks so handsome
MPLS综合实验