/***********************************************************
我的信息: *
姓名: 汪建林 生日:1985年2月26日 *
毕业学校: 2007年于成都理工大学 *
家乡地址: 四川渠县望溪乡包山村5组 *
联系QQ: 287307421 联系电话: 13558690869 *
联系Email: wangjianlin1985@126.com 287307421 *
双鱼林程序淘宝店: http://shop34864101.taobao.com *
双鱼林程序拍拍店: http://287307421.paipai.com *
网站: http://www.shuangyulin.com *
*
需要更多程序可以联系我,保证运行! *
***********************************************************/
#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#include "string.h"
#define N 10
#define FILENAME "student.txt"
typedef struct
{
int num1;
char name1[10];
int fen;
}LESSON;
typedef struct
{
int num2; /*学号*/
char name2[10];/*姓名*/
char xing[10];
int num3;
int tele;
float score[3];
float zong;
float fen2;
}STUDENT;
/*******************************************************
功能:显示菜单
参数:无
返回值:无
*******************************************************/
void displayMenu()
{
printf("\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf("+ 学生成绩管理系统2.0 +\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("+ +\n");
printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
}
/*******************************************************
功能:登陆函数,验证口令
参数:
参数1:n
类型:char []
说明:用户输入口令
返回值:1或0
类型:int
说明:1表示通过验证;0表示没有通过
*******************************************************/
int login(char password[])
{
static char LESSONy[10]="123";
if(strcmp(password,LESSONy)==0)
return 1;
else
return 0;
}
int readFromFile2(LESSON lesson[])
{
FILE *fp=NULL;
int i=0;
fp=fopen("student2","rb");
if(fp!=NULL)
{
while(!feof(fp))
{
if(i>=N)
break;
if(fread(lesson+i,sizeof(LESSON),1,fp))
i++;
}
fclose(fp);
}
return i;
}
/*******************************************************
功能:从文件读信息到结构体数组中
参数:
参数1:student[]
类型:STUDENT []
说明:用来存储从文件读到的学生信息
返回值:i
类型:int
说明:表示实际读取到的个数
*******************************************************/
int readFromFile(STUDENT student[])
{
FILE *fp=NULL;
int i=0;
fp=fopen(FILENAME,"rb");
if(fp!=NULL)
{
while(!feof(fp))
{
if(i>=N)
break;
if(fread(student+i,sizeof(STUDENT),1,fp))
i++;
}
fclose(fp);
}
return i;
}
/*******************************************************
功能:判断学号是否唯一
参数:
参数1:student[]
类型:STUDENT []
说明:存储学生信息的数组
参数2:length
类型:int
说明:表示实际数组的长度
参数2:stuNumber
类型:int
说明:要判断的学号
返回值:1或0(flag)
类型:int
说明:1表示学号唯一;0表示学号不唯一
*******************************************************/
int unique(STUDENT student[],int length,int stuNumber)
{
int flag=1,i;
for(i=0;i<length;i++)
{
if(student[i].num2==stuNumber)
{
flag=0;
break;
}
}
return flag;
}
void inputInfo1(LESSON *lesson)
{
printf("请输入课程信息:\n");
printf("课程编号:");
scanf("%d",&lesson->num1);
printf("课程名称:");
scanf("%s",lesson->name1);
printf("学分:");
scanf("%d",&lesson->fen);
}
int inputInfo2(STUDENT student[],int length)
{
int i=length;
int endFlag=0;
printf("请输入学生信息(以学号为0结束):\n");
while(i<N)
{
while(1)
{
int flag;
printf("学号:");
scanf("%d",&student[i].num2);
if(student[i].num2==0)
{
endFlag=1;
break;
}
flag=unique(student,i,student[i].num2);
if(flag) break;
printf("该学号已经存在,请重新输入!\n");
}
if(endFlag==1)
break;
printf("姓名:");
scanf("%s",student[i].name2);
printf(" 性别:");
scanf("%s",student[i].xing);
while(1)
{
printf("宿舍号码:");
if(scanf("%d",&student[i].num3)==1)
break;
printf("输入格式不对,请重新输入!\n");
while(getchar()!='\n')
continue;
}
while(1)
{
printf("电话号码:");
if(scanf("%d",&student[i].tele)==1)
break;
printf("输入格式不对,请重新输入!\n");
while(getchar()!='\n')
continue;
}
while(1)
{
printf("平时成绩:");
if(scanf("%f",&student[i].score[1])==1)
break;
printf("输入格式不对,请重新输入!\n");
while(getchar()!='\n')
continue;
}
while(1)
{
printf("实验成绩:");
if(scanf("%f",&student[i].score[2])==1)
break;
printf("输入格式不对,请重新输入!\n");
while(getchar()!='\n')
continue;
}
while(1)
{
printf("卷面成绩:");
if(scanf("%f",&student[i].score[3])==1)
break;
printf("输入格式不对,请重新输入!\n");
while(getchar()!='\n')
continue;
}
while(getchar()!='\n')
continue;
i++;
}
return i;
}
/*输入一个学号,查出此生的基本信息并显示输出*/
void xuehao(STUDENT student[],int length,int stuNum2)
{
int i=0;
for(i=0;i<length;i++)
{
if(stuNum2==student[i].num2)
{
printf("找到啦!他的基本信息是 :%d\n", i);
printf("%-4s %-4s %-4s %-8s %-8s %-10s %-8s %-8s","学号","姓名","性别","宿舍号码","电话号码","平时成绩","实验成绩","卷面成绩","综合成绩","实得学分");
printf("\n%-4d %-4s %-4s %-8d %-8d %-4f %-3f %-3f %-8f %-8f\n",student[i].num2,student[i].name2,student[i].xing,student[i].num3,student[i].tele,student[i].score[1],student[i].score[2],student[i].score[3],student[i].zong,student[i].fen2);
break;
}
}
if(i>=length)
printf("\n不存在!\n");
}
/*输入一个姓名,查出此生的基本信息并显示输出。*/
void name(STUDENT student[],int length,char stuname2[])
{
int i=0;
for(i=0;i<length;i++)
{
if(strcmp(stuname2,student[i].name2)==0)
{
printf("找到啦!他的基本信息是 :%d\n", i);
printf("%-4s %-4s %-4s %-8s %-8s %-10s %-8s %-8s","学号","姓名","性别","宿舍号码","电话号码","平时成绩","实验成绩","卷面成绩","综合成绩","实得学分");
printf("\n%-4d %-4s %-4s %-8d %-8d %-4f %-3f %-3f %-8f %-8f\n",student[i].num2,student[i].name2,student[i].xing,student[i].num3,student[i].tele,student[i].score[1],student[i].score[2],student[i].score[3],student[i].zong,student[i].fen2);
break;
}
}
if(i>=length)
printf("\n不存在!\n");
}
/*输入一个宿舍号码,可查询出本室所有的学生的基本信息并显示输出。*/
void suse(STUDENT student[],int length,int stuNum3)
{
int i=0;
for(i=0;i<length;i++)
{
if(stuNum3==student[i].num3)
{
printf("找到啦!他们的基本信息是 :%d\n", i);
printf("%-4s %-4s %-4s %-8s %-8s %-10s %-8s %-8s","学号","姓名","性别","宿舍号码","电话号码","平时成绩","实验成绩","卷面成绩","综合成绩","实得学分");
printf("\n%-4d %-4s %-4s %-8d %-8d %-4f %-3f %-3f %-8f %-8f\n",student[i].num2,student[i].name2,st
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![py](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
共 17 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/6ba19994c6c3461f8cf75ff80f635020_qq_34910341.jpg!1)
CyMylive.
- 粉丝: 7501
- 资源: 4万+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- matlab画图教程.docx
- 基于MNIST数据集卷积神经网络实现手写数字识别(GUI).zip
- 一个MATLAB仿真设计的例子,演示如何对一个模拟信号进行傅里叶变换:
- 10-Hadoop(HA)V4.0.docx
- 基于MNIST数据集卷积神经网络实现手写数字识别(GUI)源码+文档说明
- 自定义函数在后缀表达式中的应用与实现
- 使用python爬取天气信息(包括历史天气数据)_python爬取天气数据-CSDN博客.html
- 毕设项目:高校学生宿舍管理系统的设计与实现(ASP.NET+源代码+论文)
- Navicat入门教程.docx
- os.path.join(root, 'test-average-edge-map'
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)