c语言成绩管理
来源:互联网 发布:nba球队数据统计排名 编辑:程序博客网 时间:2024/04/25 19:12
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define N 100
void openfile();
void savefile();
void editmenu();
void findmenu();
void mysort();
void mystat();
void mystat();
void mymodify();
void mainmenu();
void myremov();
void someonerec();
void input();
void so();
struct student
{ char num[12];
float score[5];
char name[30];
float avg;
};
struct student stu[100];
int n=0;
void input()
{
int i=n; float temp1,temp2,temp3,temp4,temp5;
char ch='y';
while(ch=='y')
{
printf("/nPlease input the name and number:");
scanf("%s%s",stu[i].name,stu[i].num);
printf("Input the 5 score:");
scanf("%f%f%f%f%f",&temp1,&temp2,&temp3,&temp4,&temp5);
stu[i].score[0]=temp1;
stu[i].score[1]=temp2;
stu[i].score[2]=temp3;
stu[i].score[3]=temp4;
stu[i].score[4]=temp5;
stu[i].avg=( stu[i].score[0]+ stu[i].score[1]+ stu[i].score[2]+ stu[i].score[3]+ stu[i].score[4])/5;
printf("continue or not(y/n)?");
scanf(" %c",&ch);
i++;
}
n=i;
printf("/nname number English Mathmatic Chinese C program Jisuanji Final/n");
for(i=0;i<n;i++)
printf("%s %s %-10.1f%-10.1f%-10.1f%-10.1f%-10.1f%-10.1f/n",stu[i].name,stu[i].num,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].score[3],stu[i].score[4], stu[i].avg);
printf("/n press any key to continue....");
getch();
}
void main( )
{ char choose='/0';
do
{ mainmenu();
scanf(" %c",&choose);
switch(choose)
{ case '1': openfile(); break;
case '2': savefile(); break;
case '3': editmenu(); break;
case '4': findmenu(); break;
case '5': mysort(); break;
case '6': mystat(); break;
case '0': exit(0);
default: printf(" Input error.Please again.");
}
}while(1);
}
void mainmenu()
{
clrscr();
printf("/n/n/n/n/n/n/n/n");
printf(" |******Student Grade Management System******|/n");
printf(" |-------------------------------------------|/n");
printf(" | Please input option(0-9): |/n");
printf(" |-------------------------------------------|/n");
printf(" | 1--Open file |/n");
printf(" | 2--save file |/n");
printf(" | 3--Edit |/n");
printf(" | 4--View |/n");
printf(" | 5--Sort |/n");
printf(" | 6--list of no degree |/n");
printf(" | 0--Exit |/n");
printf(" |-------------------------------------------|/n");
}
void editmenu()
{ char choose='/0';
do
{
clrscr();
printf("/n/n/n/n/n/n/n/n");
printf(" |-------------------------------------------|/n");
printf(" | Please input option(0-3): |/n");
printf(" |-------------------------------------------|/n");
printf(" | 1----Add record |/n");
printf(" | 2----Del record |/n");
printf(" | 3----Modify record |/n");
printf(" | 0----Return mainmenu |/n");
printf(" |-------------------------------------------|/n");
scanf(" %c",&choose);
switch(choose)
{ case '1': input(); break;
case '2': myremov(); break;
case '3': mymodify(); break;
case '0': return;
default: printf(" Input error.Please again.");
}
}while(1);
}
void openfile()
{
}
void savefile()
{}
void findmenu()
{ char sh='/0';
do
{
clrscr();
printf("/n/n/n/n/n/n/n/n");
printf(" |---------------------------------------------|/n");
printf(" | Please input option(0-2) |/n");
printf(" |---------------------------------------------|/n");
printf(" | 1----View of whole record |/n");
printf(" | 2----View of someone record |/n");
printf(" | 0----Return mainmenu |/n");
printf(" |---------------------------------------------|/n");
scanf("%c",&sh);
switch(sh)
{
case'1': so(); break;
case'2': someonerec(); break;
case'0': return;
default: printf("Input error.please again.");
}
}while(1);
}
void mysort()
{ struct student temp;
int i,j;
for(j=0;j<n;j++);
for(i=0;i<n-j-1;i++)
if(stu[i].avg<stu[i+1].avg)
{
temp=stu[i];
stu[i]=stu[i+1];
stu[i+1]=temp;
}
printf("Name Number English Chinese C program Jisuanji Final/n");
for(i=0;i<n;i++)
printf("%s %s %-10.1f%-10.1f%-10.1f%-10.1f%-10.1f%-10.1f/n",stu[i].name,stu[i].num,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].score[3],stu[i].score[4], stu[i].avg);
printf(" press any key continue...."); getch();
}
void mystat()
{ int i,j; int flag=0;
printf(" The list of no degree/n");
printf("Name number english mathmatic chinese c program final/n");
for(i=0;i<n;i++)
for(j=0;j<5;j++)
if(stu[i].score[j]<60)
{
flag=1;
printf("%s %s %-10.1f%-10.1f%-10.1f%-10.1f%-10.1f%-10.1f/n",stu[i].name,stu[i].num,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].score[3],stu[i].score[4], stu[i].avg);
break;
}
if(flag==1) printf("%-8.s%-8.s",stu[i].name,stu[i].num);
printf(" press any key to continue....");
getch();
}
void mymodify()
{ char s='y';char name[30];
int i=0,flag=0,j=0;
float k,sum=0;
while(s=='y')
{
printf("input the name of modifing:");
flag=0;
scanf("%s",name);
getch();
for(i=0;i<n;i++)
{
if(strcmp(name,stu[i].name)==0)
{
flag=1;
printf("please input new score:/n");
for(j=0;j<5;j++)
{
scanf("%f",&k);
stu[i].score[j]=k;
sum=sum+stu[i].score[j];
}
stu[i].avg=sum/5;
getch();
printf("name num socore1 score2 score3 score4 score5 score6/n");
printf("%s %s%8.1f%8.1f%8.1f%8.1f%8.1f%8.1f/n",stu[i].name,stu[i].num,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].score[3],stu[i].score[4],stu[i].avg);
}
}
if(!flag)
printf("No this person.");
printf("Continue to modify(y/n)");
scanf("%c",&s);
}
printf(" press any key to continue..../n");
getch();
}
void myremov()
{
char name[30];char h='y';
int i=0,j=0,flag=0;
while(h=='y')
{
printf("input name of deleting:");
flag=0;
scanf("%s",name);
getch();
for(i=0;i<n;i++)
{
if(strcmp(name,stu[i].name)==0)
{
flag=1;
for(j=i;j<n-1;j++)
stu[j]=stu[j+1];
n--;
for(i=0;i<n;i++)
printf("%-5s%-6s",stu[i].name,stu[i].num);
}
}
if(!flag)
printf("/nno person!");
printf("continue input to (y/n)?");
scanf("%c",&h);
}
printf(" press any key to continue..../n");
getch();
}
void someonerec()
{
char name[30];int i;
printf("/nPlease input name to display:");
scanf("%s",name);
for(i=0;i<n;i++)
{
if(strcmp(name,stu[i].name)==0)
{ printf("name num socore1 score2 score3 score4 score5/n");
printf("%s %s%8.1f%8.1f%8.1f%8.1f%8.1f/n",stu[i].name,stu[i].num,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].score[3],stu[i].score[4]);
}
else
printf("No this person!/n");
}
printf(" press any key continue....");
getch();
}
void so()
{ int i;
printf("Name Number English Mathmatic C promgram Jisuanji Final/n");
for(i=0;i<n;i++)
printf("%s %s %-10.1f%-10.1f%-10.1f%-10.1f%-10.1f%-10.1f/n",stu[i].name,stu[i].num,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].score[3],stu[i].score[4], stu[i].avg);
printf( "Press any key to contine.....");
getch();
}
- c语言成绩管理
- [C语言]学生成绩管理
- c 实现学生成绩管理
- 学生成绩管理C实现
- c语言成绩统计系统
- C语言实验--成绩转换
- C语言:成绩最高学号
- 第十五周—C语言 项目2(学生成绩管理)
- 学员成绩管理的简单C实现
- 学生成绩管理代码(c代码)
- C语言完成一个学生成绩管理程序
- C语言之排学生成绩
- c语言 判断一个学生成绩等级
- C语言编写的学生成绩管理程序
- C语言排序(10)___ACM成绩统计
- C语言课设-班级成绩统计分析
- YTU 2416: C语言习题 成绩输出
- Problem G: C语言习题 成绩输出
- Java编写的时钟
- QQ登录界面
- 基于GDI+的图像处理软件制作(VC)
- 周日的闲谈
- 一种根据关键字进行分类的文本分类算法
- c语言成绩管理
- Ext Combo 联动
- 另类思路用C#写自删除程序
- 7100t 快捷键
- 2009年大记事盘点之团队文化与成长
- 基于Visual C++2010与windows SDK fo windows7开发Windows 7的多点触摸特性应用程序(1)
- Onpaint和OnDraw的区别[转]
- 如何使用VS 2005 制作安装部署自己的应用程序
- C语言中的EOF和feof()