|
|
@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
#include<stdio.h>
|
|
|
|
|
|
|
|
#include<windows.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void welcome(); //欢迎界面
|
|
|
|
|
|
|
|
void add(); //添加
|
|
|
|
|
|
|
|
void delete(); //删除
|
|
|
|
|
|
|
|
void idfind(); //学号查询
|
|
|
|
|
|
|
|
void namefind(); //姓名查询
|
|
|
|
|
|
|
|
void ranking(); //排名
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int n;
|
|
|
|
|
|
|
|
struct
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
long int id; //学号
|
|
|
|
|
|
|
|
char name[20]; //姓名
|
|
|
|
|
|
|
|
double cj; //C语言成绩
|
|
|
|
|
|
|
|
} student[200];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
*欢迎界面
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void welcom()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
system("color e0"); //背景颜色和字体颜色,前为背景颜色,后为字体颜色
|
|
|
|
|
|
|
|
printf("-------欢-迎-来-到-学-生-成-绩-记-录-簿---------\n");
|
|
|
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
|
|
|
printf("| 1.添加 |\n");
|
|
|
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
|
|
|
printf("| 2.删除 |\n");
|
|
|
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
|
|
|
printf("| 3.学号查询 |\n");
|
|
|
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
|
|
|
printf("| 4.姓名查询 |\n");
|
|
|
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
|
|
|
printf("| 5.成绩排名、各分数段情况、及格率和平均分 |\n");
|
|
|
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
|
|
|
printf("| 6.写入文本文件 |\n");
|
|
|
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
|
|
|
printf("| 7.读取文本文件 |\n");
|
|
|
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
|
|
|
printf("| 0.退出 |\n");
|
|
|
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
|
|
|
printf("| 选择【1 2 3 4 5 6 7 0】,你所需要的服务 |\n");
|
|
|
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
*添加
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void add()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int x; //所添加人员的个数
|
|
|
|
|
|
|
|
int i; //变量
|
|
|
|
|
|
|
|
printf("请输入你要添加的人数\n");
|
|
|
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
|
|
|
for(i=0;i<x;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("请输入添加人的学号:");
|
|
|
|
|
|
|
|
scanf("%ld",student[i].id);
|
|
|
|
|
|
|
|
printf("请输添加人的姓名:");
|
|
|
|
|
|
|
|
scanf("%s",student[i].name);
|
|
|
|
|
|
|
|
printf("请输入添加人的C语言成绩:");
|
|
|
|
|
|
|
|
scanf("%ld",student[i].cj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
*删除
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void delete()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
*学号查询
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void idfind()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
*姓名查询
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void namefind()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
*排名
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ranking()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
welcom();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|