当前位置:网站首页>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;//向后移动。
}
}
边栏推荐
- Install third-party packages via whl
- typescript56 - generic interface
- 卡尔曼滤波器KF
- [Miscellaneous] How to install the specified font into the computer and then use the font in the Office software?
- 《The Google File System》新说
- 第1章:初识数据库与MySQL----MySQL安装
- LeetCode 19:删除链表的倒数第 N 个结点
- typescript50 - type specification between cross types and interfaces
- iframe通信
- A Preliminary Study of RSS Subscription to WeChat Official Account-feed43
猜你喜欢
MATLAB三维绘图命令plot3入门
[Miscellaneous] How to install the specified font into the computer and then use the font in the Office software?
MPLS综合实验
dynamic memory two
c语言分层理解(c语言操作符)
The problem of disorganized data output by mnn model
手撕Gateway源码,今日撕工作流程、负载均衡源码
新一代服务网关Gateway的实践笔记
Getting started with MATLAB 3D drawing command plot3
The Beijing E-sports Metaverse Forum was successfully held
随机推荐
手撕Gateway源码,今日撕工作流程、负载均衡源码
2022年8月份DAMA-CDGA/CDGP数据治理认证招生简章
机器学习——库
Analysis: What makes the Nomad Bridge hack unique
Apple told Qualcomm: I bought a new campus for $445 million and may plan to speed up self-development of baseband chips
.NET Static Code Weaving - Rougamo Release 1.1.0
114. How to find the cause of Fiori Launchpad routing error by single-step debugging
现货白银需要注意八大事项
Jmeter cross-platform operation CSV files
c语言分层理解(c语言操作符)
建木DevOps流程的快速运用
带你造轮子,自定义一个随意拖拽可吸边的悬浮View组件
ENS域名注册量创历史新高 逆市增长之势?光环之下存在炒作风险
米哈游--测试开发提前批
Justin Sun: Web3.0 and the Metaverse will assist mankind to enter the online world more comprehensively
Mvc, Mvp and Mvvm
2015年开源大事件汇总
boot issue
jmeter distributed stress test
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