⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c语言の学生成绩管理系统.html

📁 这是一个我在网上找的c语言の学生成绩管理系统一个C语言开发的程序比较好
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<STRONG><FONT color=#003399>
<P><FONT size=2>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;关于本程序的说明:<BR>
  本程序在vc++6.0下编译通过。程序的功能是对学<BR>
  生的资料进行有效的管理,其中包括增加资料,删<BR>
  除资料,修改资料,查询,显示已经保存的资料,<BR>
  统计学生资料,对学生成绩进行排序,在文件中<BR>
  保存学生资料等。*/</FONT></P>
<P><FONT size=2>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编程思想:<BR>
  &nbsp;&nbsp;程序运行时先按本系统默认的路径("g:\\student")去查找<BR>
  文件,若该文件存在,则将文件的内容调入内存,否则建立<BR>
  新的文件g:\\student。为保证文件的安全,将文件的内容调<BR>
  入内存后,立即关闭文件,对内容所做的所有修改均在内存中<BR>
  完成。除非用户调用保存命令,否则所有内容将在程序退出<BR>
  之前询问用户是否保存,然后做相应的动作(保存或不保存).*/</FONT></P>
<P><FONT size=2>#include "stdio.h"<BR>
  #include "stdlib.h"<BR>
  #include "string.h"<BR>
  int shoudsave=0; //<BR>
  struct student<BR>
  {<BR>
  char&nbsp;&nbsp;num[10];//学号<BR>
  char name[20];<BR>
  char ***[4];<BR>
  int cgrade;<BR>
  int mgrade;<BR>
  int egrade;<BR>
  int totle;<BR>
  int ave;<BR>
  char neartime[10];//最近更新时间<BR>
  };</FONT></P>
<P><FONT size=2>typedef struct node<BR>
  {<BR>
  struct student data;<BR>
  struct node *next;<BR>
  }Node,*Link;</FONT></P>
<P><FONT size=2>void menu()<BR>
  {<BR>
  printf("********************************************************************************");<BR>
  printf("\t1输入学生资料\t\t\t\t\t2删除学生资料\n");<BR>
  printf("\t3查询学生资料\t\t\t\t\t4修改学生资料\n");<BR>
  printf("\t5显示学生资料\t\t\t\t\t6统计学生成绩\n");<BR>
  printf("\t7排序学生成绩\t\t\t\t\t8保存学生资料\n");<BR>
  printf("\t9获取帮助信息\t\t\t\t\t0退出系统\n");<BR>
  printf("********************************************************************************\n");<BR>
  }</FONT></P>
<P><FONT size=2>void printstart()<BR>
  {<BR>
  printf("-----------------------------------------------------------------------\n");<BR>
  }<BR>
  void Wrong()<BR>
  {<BR>
  printf("\n=====&gt;提示:输入错误!\n");<BR>
  }</FONT></P>
<P><FONT size=2>void Nofind()<BR>
  {<BR>
  printf("\n=====&gt;提示:没有找到该学生!\n");<BR>
  }</FONT></P>
<P><FONT size=2>void printc() // 本函数用于输出中文<BR>
  {<BR>
  printf("&nbsp;&nbsp;学号\t&nbsp;&nbsp;&nbsp;&nbsp;姓名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;性别 
  英语成绩 数学成绩 C语言成绩&nbsp;&nbsp; 总分&nbsp;&nbsp;平均分\n");<BR>
  }</FONT></P>
<P><FONT size=2>void printe(Node *p)//本函数用于输出英文<BR>
  {<BR>
  printf("%-12s%s\t%s\t%d\t%d\t%d\t&nbsp;&nbsp; %d\t %d\n",p-&gt;data.num,p-&gt;data.name,p-&gt;data.***,p-&gt;data.egrade,p-&gt;data.mgrade,p-&gt;data.cgrade,p-&gt;data.totle,p-&gt;data.ave);<BR>
  }</FONT></P>
<P><FONT size=2>Node* Locate(Link l,char findmess[],char nameornum[])&nbsp;&nbsp;//该函数用于定位连表中符合要求的接点,并返回该指针<BR>
  {<BR>
  Node *r;<BR>
  if(strcmp(nameornum,"num")==0) //按学号查询<BR>
  {<BR>
  &nbsp;&nbsp;r=l-&gt;next;<BR>
  &nbsp;&nbsp;while(r)<BR>
  &nbsp;&nbsp;{<BR>
  &nbsp;&nbsp; if(strcmp(r-&gt;data.num,findmess)==0)<BR>
  &nbsp;&nbsp;&nbsp;&nbsp;return r;<BR>
  &nbsp;&nbsp; r=r-&gt;next;<BR>
  &nbsp;&nbsp;}<BR>
  }<BR>
  else if(strcmp(nameornum,"name")==0)&nbsp;&nbsp;//按姓名查询<BR>
  {<BR>
  &nbsp;&nbsp;r=l-&gt;next;<BR>
  &nbsp;&nbsp;while(r)<BR>
  &nbsp;&nbsp;{<BR>
  &nbsp;&nbsp; if(strcmp(r-&gt;data.name,findmess)==0)<BR>
  &nbsp;&nbsp;&nbsp;&nbsp;return r;<BR>
  &nbsp;&nbsp; r=r-&gt;next;<BR>
  &nbsp;&nbsp;}<BR>
  }<BR>
  return 0;<BR>
  }</FONT></P>
<P><FONT size=2>void Add(Link l)&nbsp;&nbsp;//增加学生<BR>
  {<BR>
  Node *p,*r,*s;<BR>
  char num[10];<BR>
  r=l;<BR>
  s=l-&gt;next;<BR>
  while(r-&gt;next!=NULL)<BR>
  &nbsp;&nbsp;r=r-&gt;next; //将指针置于最末尾<BR>
  while(1)<BR>
  {<BR>
  &nbsp;&nbsp;printf("请你输入学号(以'0'返回上一级菜单:)");<BR>
  &nbsp;&nbsp;scanf("%s",num);<BR>
  &nbsp;&nbsp;if(strcmp(num,"0")==0)<BR>
  &nbsp;&nbsp; break;<BR>
  &nbsp;&nbsp;while(s)<BR>
  &nbsp;&nbsp;{<BR>
  &nbsp;&nbsp; if(strcmp(s-&gt;data.num,num)==0)<BR>
  &nbsp;&nbsp; {<BR>
  &nbsp;&nbsp;&nbsp;&nbsp;printf("=====&gt;提示:学号为'%s'的学生已经存在,若要修改请你选择'4 修改'!\n",num);<BR>
  &nbsp;&nbsp;&nbsp;&nbsp;printstart();<BR>
  &nbsp;&nbsp;&nbsp;&nbsp;printc();<BR>
  &nbsp;&nbsp;&nbsp;&nbsp;printe(s);<BR>
  &nbsp;&nbsp;&nbsp;&nbsp;printstart();<BR>
  &nbsp;&nbsp;&nbsp;&nbsp;printf("\n");<BR>
  &nbsp;&nbsp;&nbsp;&nbsp;return;<BR>
  &nbsp;&nbsp; }<BR>
  &nbsp;&nbsp; s=s-&gt;next;<BR>
  &nbsp;&nbsp;}<BR>
  &nbsp;&nbsp;<BR>
  &nbsp;&nbsp;p=(Node *)malloc(sizeof(Node));<BR>
  &nbsp;&nbsp;<BR>
  &nbsp;&nbsp;strcpy(p-&gt;data.num,num);<BR>
  &nbsp;&nbsp;printf("请你输入姓名:");<BR>
  &nbsp;&nbsp;scanf("%s",p-&gt;data.name);<BR>
  &nbsp;&nbsp;getchar();<BR>
  &nbsp;&nbsp;printf("请你输入性别:");<BR>
  &nbsp;&nbsp;scanf("%s",p-&gt;data.***);<BR>
  &nbsp;&nbsp;getchar();<BR>
  &nbsp;&nbsp;printf("请你输入c语言成绩:");<BR>
  &nbsp;&nbsp;scanf("%d",&amp;p-&gt;data.cgrade);<BR>
  &nbsp;&nbsp;getchar();<BR>
  &nbsp;&nbsp;printf("请你输入数学成绩:");<BR>
  &nbsp;&nbsp;scanf("%d",&amp;p-&gt;data.mgrade);<BR>
  &nbsp;&nbsp;getchar();<BR>
  &nbsp;&nbsp;printf("请你输入英语成绩:");<BR>
  &nbsp;&nbsp;scanf("%d",&amp;p-&gt;data.egrade);<BR>
  &nbsp;&nbsp;getchar();<BR>
  &nbsp;&nbsp;p-&gt;data.totle=p-&gt;data.egrade+p-&gt;data.cgrade+p-&gt;data.mgrade;<BR>
  &nbsp;&nbsp;p-&gt;data.ave=p-&gt;data.totle / 3;<BR>
  &nbsp;&nbsp;//信息输入已经完成<BR>
  &nbsp;&nbsp;p-&gt;next=NULL;<BR>
  &nbsp;&nbsp;r-&gt;next=p;<BR>
  &nbsp;&nbsp;r=p;<BR>
  &nbsp;&nbsp;shoudsave=1;<BR>
  &nbsp;&nbsp;<BR>
  }<BR>
  }</FONT></P>
<P><FONT size=2>void Qur(Link l) //查询学生<BR>
  {<BR>
  int sel;<BR>
  char findmess[20];<BR>
  Node *p;<BR>
  if(!l-&gt;next)<BR>
  {<BR>
  &nbsp;&nbsp;printf("\n=====&gt;提示:没有资料可以查询!\n");<BR>
  &nbsp;&nbsp;return;</FONT></P>
<P><FONT size=2>}<BR>
  printf("\n=====&gt;1按学号查找\n=====&gt;2按姓名查找\n");<BR>
  scanf("%d",&amp;sel);<BR>
  if(sel==1)//学号<BR>
  {<BR>
  &nbsp;&nbsp;printf("请你输入要查找的学号:");<BR>
  &nbsp;&nbsp;scanf("%s",findmess);<BR>
  &nbsp;&nbsp;p=Locate(l,findmess,"num");<BR>
  &nbsp;&nbsp;if(p)<BR>
  &nbsp;&nbsp;{<BR>
  &nbsp;&nbsp; printf("\t\t\t\t查找结果\n");<BR>
  &nbsp;&nbsp; printstart();<BR>
  &nbsp;&nbsp; printc();<BR>
  &nbsp;&nbsp; printe(p);<BR>
  &nbsp;&nbsp; printstart();<BR>
  &nbsp;&nbsp;}<BR>
  &nbsp;&nbsp;else<BR>
  &nbsp;&nbsp; Nofind();<BR>
  }<BR>
  else if(sel==2) //姓名<BR>
  {<BR>
  &nbsp;&nbsp;printf("请你输入要查找的姓名:");<BR>
  &nbsp;&nbsp;scanf("%s",findmess);<BR>
  &nbsp;&nbsp;p=Locate(l,findmess,"name");<BR>
  &nbsp;&nbsp;if(p)<BR>
  &nbsp;&nbsp;{<BR>
  &nbsp;&nbsp; printf("\t\t\t\t查找结果\n");<BR>
  &nbsp;&nbsp; printstart();<BR>
  &nbsp;&nbsp; printc();<BR>
  &nbsp;&nbsp; printe(p);<BR>
  &nbsp;&nbsp; printstart();<BR>
  &nbsp;&nbsp;}<BR>
  &nbsp;&nbsp;else<BR>
  &nbsp;&nbsp; Nofind();<BR>
  }<BR>
  else<BR>
  &nbsp;&nbsp;Wrong();<BR>
  &nbsp;&nbsp;<BR>
  }</FONT></P>
<P><FONT size=2>void Del(Link l) //删除<BR>
  {<BR>
  int sel;<BR>
  Node *p,*r;<BR>
  char findmess[20];<BR>
  if(!l-&gt;next)<BR>
  {<BR>
  &nbsp;&nbsp;printf("\n=====&gt;提示:没有资料可以删除!\n");<BR>
  &nbsp;&nbsp;return;<BR>
  }<BR>
  printf("\n=====&gt;1按学号删除\n=====&gt;2按姓名删除\n");<BR>
  scanf("%d",&amp;sel);<BR>
  if(sel==1)<BR>
  {<BR>
  &nbsp;&nbsp;printf("请你输入要删除的学号:");<BR>
  &nbsp;&nbsp;scanf("%s",findmess);<BR>
  &nbsp;&nbsp;p=Locate(l,findmess,"num");<BR>
  &nbsp;&nbsp;if(p)<BR>
  &nbsp;&nbsp;{<BR>
  &nbsp;&nbsp; r=l;<BR>
  &nbsp;&nbsp; while(r-&gt;next!=p)<BR>
  &nbsp;&nbsp;&nbsp;&nbsp;r=r-&gt;next;<BR>
  &nbsp;&nbsp; r-&gt;next=p-&gt;next;<BR>
  &nbsp;&nbsp; free(p);<BR>
  &nbsp;&nbsp; printf("\n=====&gt;提示:该学生已经成功删除!\n");<BR>
  &nbsp;&nbsp; shoudsave=1;<BR>
  &nbsp;&nbsp;}<BR>
  &nbsp;&nbsp;else<BR>
  &nbsp;&nbsp; Nofind();<BR>
  }<BR>
  else if(sel==2)<BR>
  {<BR>
  &nbsp;&nbsp;printf("请你输入要删除的姓名:");<BR>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -