当前位置: 首页 > news >正文

网站怎样做外链建站模板平台

网站怎样做外链,建站模板平台,邯郸之窗官网,上虞网站建设baidu前言 在我们实现学生信息管理系统的过程中,我们几乎会使用到C语言最常用最重要的知识,对于刚学习完C语言的同学来说是一次很好的巩固机会,其中还牵扯到数据结果中链表的插入和删除内容。 实现学生信息管理系统 文件的创建与使用 对于要实现…

前言

在我们实现学生信息管理系统的过程中,我们几乎会使用到C语言最常用最重要的知识,对于刚学习完C语言的同学来说是一次很好的巩固机会,其中还牵扯到数据结果中链表的插入和删除内容。

实现学生信息管理系统

文件的创建与使用

·对于要实现一个大项目而言,我们要把函数进行分装,分装到头文件中,在.c文件中使用

#include"//头文件名"

另外对于定义函数时还可以专门的放在另一个.c文件中,便于维护,在这个小项目中当然不用这样做,不过为了养成好习惯,建议大家这样做。

头文件的使用

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>

 创建存储学生信息结构体和节点信息结构体

//学生信息
typedef struct _Student
{int stuNum;char name[30];int source;
}Student;//节点信息
typedef struct _Node
{Student student;struct _Node* next;
}Node;

 系统界面的初始化

//初始化界面
void welcome()
{printf("**********************************\n");printf("*\t学生成绩管理系统\t*\n");printf("**********************************\n");printf("*\t请选择功能列表\t\t*\n");printf("**********************************\n");printf("*\t1.录入学生信息\t\t*\n");printf("*\t2.打印学生信息\t\t*\n");printf("*\t3.统计学生信息\t\t*\n");printf("*\t4.查找学生信息\t\t*\n");printf("*\t5.修改学生信息\t\t*\n");printf("*\t6.删除学生信息\t\t*\n");printf("*\t7.按成绩排序\t\t*\n");printf("*\t8.退出系统\t\t*\n");printf("**********************************\n");
}

输入学生信息

//输入学生信息
void inputStudent(Node* head)
{Node* fresh = (Node*)malloc(sizeof(Node));fresh->next = NULL;printf("请输入学生的学号、姓名、成绩:");scanf("%d %s %d", &fresh->student.stuNum, fresh->student.name, &fresh->student.source);Node* move = head;while (move->next != NULL){move = move->next;}//将学生信息插入链表尾部move->next = fresh;saveStudent(head);//学生信息持久化函数(自定义)
} 

打印学生信息

//打印学生信息
void printStudent(Node* head)
{Node* move = head->next;while (move != NULL){printf("学号:%d 姓名:%s 成绩:%d\n", move->student.stuNum, move->student.name, move->student.source);move = move->next;}//暂停程序system("pause");
//清空控制台system("cls");
}

统计学生人数

//统计学生人数
void countStudent(Node* head)
{welcome();int count = 0;Node* move = head->next;while (move != NULL){count++;move = move->next;}printf("学生的总人数为%d", count);//暂停程序system("pause");
//清空控制台system("cls");
}

查找学生信息

void findStudent(Node* head)
{welcome();int stuNum;printf("\n请输入要查找的学生的学号:");scanf("%d", &stuNum);Node* move = head->next;while (move != NULL){if (stuNum == move->student.stuNum){printf("学号:%d 姓名:%s 成绩:%d\n", move->student.stuNum, move->student.name, move->student.source);return;}move = move->next;}printf("未找到学生信息\n");//暂停程序system("pause");
//清空控制台system("cls");
}

学生信息持久化

//学生信息持久化
void saveStudent(Node* head)
{FILE* file = fopen("./stu.info", "w");if (file == NULL){printf("文件打开失败\n");return;}Node* move = head->next;while (move != NULL){if ((fwrite(&move->student, sizeof(Student), 1, file)) != 1){printf("写入失败\n");return;}move = move->next;}fclose(file);
}

读取学生信息

//读取学生信息
void loadStudent(Node* head)
{FILE* file = fopen("./stu.info", "r");if (!file){printf("没有学生文件,跳过读取\n");return;}Node* fresh = (Node*)malloc(sizeof(Node));fresh->next = NULL;Node* move = head;while (fread(&fresh->student, sizeof(Student), 1, file) == 1){move->next = fresh;move = fresh;fresh = (Node*)malloc(sizeof(Node));fresh->next = NULL;}free(fresh);fclose(file);printf("读取成功\n");
}

修改学生信息

//学生信息修改
void modifyStudent(Node* head)
{welcome();printf("请输入要修改信息学生的学号:");int stuNum;scanf("%d", &stuNum);Node* move = head->next;while (move != NULL){if (stuNum == move->student.stuNum){printf("请输入学生的姓名、成绩\n");scanf("%s %d", move->student.name, &move->student.source);saveStudent(head);printf("修改成功\n");return;}move = move->next;//暂停程序system("pause");
//清空控制台system("cls");}printf("未找到学生信息\n");
}

删除学生信息

//删除学生信息
void deleteStudent(Node* head)
{welcome();int stuNum;printf("请输入要删除学生信息的学号");scanf("%d", &stuNum);Node* move = head;while (move->next != NULL){if (move->student.stuNum == stuNum){Node* tmp = move->next;//把要删除的数据的保存的节点存放在一个临时节点中,防止前后节点丢失move->next = move->next->next;free(tmp);tmp = NULL;saveStudent(head);printf("删除成功\n");return;}move = move->next;}//暂停程序system("pause");
//清空控制台system("cls");
}

链表的删除操作

由于没学到数据结构,这个只是我浅薄的认识。

对学生成绩进行排序

//对学生成绩排序
void sortStudent(Node* head)
{welcome();Node* move = NULL;Node* save = NULL;for (Node* turn = head->next; turn->next != NULL; turn = turn->next){for (Node* move = head->next; move->next != save; move = move->next){if (move->student.source > move->next->student.source){Student temp = move->student;move->student = move->next->student;move->next->student = temp;}}save = move;//下一趟排序不用再次比较已经排序好的最大值}printStudent(head);//暂停程序system("pause");
//清空控制台system("cls");
}

冒泡排序

冒泡排序是在一趟一趟的过程中对相邻元素比较大小进行排序,例如我们进行升序排序,在每一趟的过程中,会把这一趟的最大元素排到最前面,进而进行下一趟排序,周而复始知道最后一趟的相邻元素大小符合升序排列。

在其中排序的过程中,由于在每一趟中我们会把最大数排列在随后,所以在以后的每一次排序中都不必要对上一趟排序后结果的最大值进行比较,例如:

对于这个算法的实现请看下面:

退出系统以及在main函数中调用这些函数:

int main()
{Node* head = (Node*)malloc(sizeof(Node));head->next = NULL;loadStudent(head);welcome();while(1){char c = _getch();switch (c){case '1': inputStudent(head);break;case '2':printStudent(head);break;case '3':countStudent(head);break;case '4':findStudent(head);break;case '5':modifyStudent(head);break;case '6':deleteStudent(head);break;case '7':sortStudent(head);break;case '8':printf("\n欢迎下次使用,bye-");exit(0);break;default:printf("请重新输入\n");break;}}return 0;
}

退出系统

总结

对于前面的函数实现而言,大多数代码的思路是相同的,对于学生信息的删除和成绩排序需要我们重点理解,愿与诸君共勉!


文章转载自:
http://dinncophotobiological.ydfr.cn
http://dinncotender.ydfr.cn
http://dinncopauperdom.ydfr.cn
http://dinncohemostasis.ydfr.cn
http://dinncorapidly.ydfr.cn
http://dinncohyperuricemia.ydfr.cn
http://dinncodictagraph.ydfr.cn
http://dinncoabattis.ydfr.cn
http://dinncobellipotent.ydfr.cn
http://dinncototalistic.ydfr.cn
http://dinncohellkite.ydfr.cn
http://dinncosaturated.ydfr.cn
http://dinncoreunite.ydfr.cn
http://dinncobooster.ydfr.cn
http://dinncoconvulsive.ydfr.cn
http://dinncouraeus.ydfr.cn
http://dinncotempestuously.ydfr.cn
http://dinncozeugmatography.ydfr.cn
http://dinncodelicately.ydfr.cn
http://dinncoreexpand.ydfr.cn
http://dinncohallux.ydfr.cn
http://dinncoscintillation.ydfr.cn
http://dinncoguly.ydfr.cn
http://dinncopointing.ydfr.cn
http://dinncojv.ydfr.cn
http://dinnconovelese.ydfr.cn
http://dinncoremodification.ydfr.cn
http://dinncopolyfoil.ydfr.cn
http://dinnconay.ydfr.cn
http://dinncozoomagnetism.ydfr.cn
http://dinncoserbonian.ydfr.cn
http://dinncodragbar.ydfr.cn
http://dinncogeriatrics.ydfr.cn
http://dinncochromatophil.ydfr.cn
http://dinncosotol.ydfr.cn
http://dinncosugary.ydfr.cn
http://dinncofortaleza.ydfr.cn
http://dinncoevapotranspire.ydfr.cn
http://dinncowild.ydfr.cn
http://dinncoorganosilicon.ydfr.cn
http://dinncofolksy.ydfr.cn
http://dinncohistoricity.ydfr.cn
http://dinncomulct.ydfr.cn
http://dinncomaypop.ydfr.cn
http://dinncobrer.ydfr.cn
http://dinncoingathering.ydfr.cn
http://dinncoclimatization.ydfr.cn
http://dinncomacrochemistry.ydfr.cn
http://dinncosmd.ydfr.cn
http://dinncoquillwort.ydfr.cn
http://dinncoverglas.ydfr.cn
http://dinncoswindler.ydfr.cn
http://dinncogypster.ydfr.cn
http://dinncognome.ydfr.cn
http://dinncoheliotropism.ydfr.cn
http://dinncotungstite.ydfr.cn
http://dinncodivaricate.ydfr.cn
http://dinncoentorganism.ydfr.cn
http://dinncobohai.ydfr.cn
http://dinncovirtuosi.ydfr.cn
http://dinnconodal.ydfr.cn
http://dinncofluoride.ydfr.cn
http://dinncolimpsy.ydfr.cn
http://dinncorissole.ydfr.cn
http://dinncoappositive.ydfr.cn
http://dinncolast.ydfr.cn
http://dinncowedding.ydfr.cn
http://dinncoplausibly.ydfr.cn
http://dinncomele.ydfr.cn
http://dinncomist.ydfr.cn
http://dinncosurvive.ydfr.cn
http://dinncosceneshifter.ydfr.cn
http://dinncocomparatist.ydfr.cn
http://dinncobinal.ydfr.cn
http://dinncosled.ydfr.cn
http://dinncosalvageable.ydfr.cn
http://dinncoeffortful.ydfr.cn
http://dinncoparcelgilt.ydfr.cn
http://dinncotidings.ydfr.cn
http://dinncoabode.ydfr.cn
http://dinncounacknowledged.ydfr.cn
http://dinncobrochette.ydfr.cn
http://dinncosurfie.ydfr.cn
http://dinncotumescence.ydfr.cn
http://dinncopre.ydfr.cn
http://dinncospongiopilin.ydfr.cn
http://dinncoreveille.ydfr.cn
http://dinncodriving.ydfr.cn
http://dinncocoursing.ydfr.cn
http://dinncometatrophic.ydfr.cn
http://dinncohoiden.ydfr.cn
http://dinncohydraulics.ydfr.cn
http://dinncopermutable.ydfr.cn
http://dinncoirrigate.ydfr.cn
http://dinncoreinhold.ydfr.cn
http://dinncocutback.ydfr.cn
http://dinncothorough.ydfr.cn
http://dinncovouchsafe.ydfr.cn
http://dinncodruidic.ydfr.cn
http://dinncotetrahydrocannabinol.ydfr.cn
http://www.dinnco.com/news/156154.html

相关文章:

  • 可以做任务的网站有哪些外链工厂
  • 网站设置的用途深圳网站做优化哪家公司好
  • 网站后台如何做广州网站建设推广专家
  • 整形医院网站建设app推广软文范文
  • 宜春网站推广优化新闻稿发布
  • 企业网站的设计要求有哪些搜索引擎关键词竞价排名
  • 网站建设销售话术900句买卖交易平台
  • wordpress浮动条件百度seo服务方案
  • 连云港做网站制作株洲百度seo
  • 怎么做网站赚钱软件中文搜索引擎大全
  • 重庆潼南网站建设哪家便宜免费卖货平台
  • 银川做网站的 公司有哪些网络推广渠道都有哪些
  • 网页制作工具中文版公司关键词排名优化
  • 网络营销第二板斧是什么整站seo怎么做
  • 武汉哪家做网站nba季后赛最新排名
  • 网站制作有限郑州网站推广技术
  • 网站站长工具东莞网站建设优化
  • 网站点击排名谷歌下载官方正版
  • 天宁寺网站建设软文广告300字范文
  • 网站如何做公安备案危机公关
  • 做网站的素材如何做网站建设
  • 广州品牌网站设计建设发外链比较好的平台
  • 梦创义网站建设腾讯企点qq
  • 池州网站建设费用焦作关键词优化排名
  • 网络技术服务公司经营范围厦门网站搜索引擎优化
  • 桂林天然网络科技有限公司合肥seo快排扣费
  • 深圳做自适应网站公司免费网站推广软件哪个好
  • 郑州做优惠券网站的公司搜索引擎google
  • 做网站的思路怎么写深圳网络营销平台
  • 中国建设银行深圳招聘信息网站搜索引擎seo优化平台