校内运动会管理系统c语言,【纯小白求助】 课程设计里面《校际运动会管理系统》源代码运行...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

【源代码如下】

#include "stdio.h" /*I/O函数*/

#include "stdlib.h" /*其它说明*/

#include "string.h" /*字符串函数*/

#include "conio.h" /*屏幕操作函数*/

#include "mem.h" /*内存操作函数*/

#include "ctype.h" /*字符操作函数*/

#include "alloc.h" /*动态地址分配函数*/

struct score

{

int mingci;

char xuehao[8];

char mingzi[20];

float score[6];

}data,info[1000];

int i,j,k=0;

char temp[20],ch;

FILE *fp,*fp1;

void shuru()

{

if((fp=fopen("s_score.txt","ab+"))==NULL)

{

printf("cannot open this file.\n");

getch();exit(0);

}

for(i=0;i<=1000;i++)

{

printf("\nPlease shuru xuehao:");

gets(data.xuehao);

printf("Please shuru mingzi:");

gets(data.mingzi);

printf("Please shuru yuwen score:");

gets(temp);data.score[0]=atof(temp);

printf("Please shuru shuxue score:");

gets(temp);data.score[1]=atof(temp);

printf("Please input yingyu score:");

gets(temp);data.score[2]=atof(temp);

printf("Please shuru wuli score:");

gets(temp);data.score[3]=atof(temp);

printf("Please shur huaxue score:");

gets(temp);data.score[4]=atof(temp);

data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];

fwrite(&data,sizeof(data),1,fp);

printf("another?y/n");

ch=getch();

if(ch=='n'||ch=='N')

break;

} fclose(fp);

}

void xianshi()

{

float s;int n;

if((fp=fopen("s_score.txt","rb+"))==NULL)

{

printf("Cannot reading this file.\n");

exit(0);

}

for(i=0;i<=1000;i++)

{

if((fread(&info[i],sizeof(info[i]),1,fp))!=1)

break;

}

printf("\nxuehao mingzi yuwen shuxue yingyu wuli huauxue zhongfen\n");

for(j=0,k=1;j

{

info[j].mingci=k;

printf("%6s %8s %3.1f %3.1f %3.1f %3.1f %3.1f %3.1f\n",info[j].xuehao,info[j].mingzi,info[j].score[0],info[j].score[1],info[j].score[2],info[j].score[3],info[j].score[4],

info[j].score[5]);

}

getch();

fclose(fp);

}

void xiugai()

{

if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)

{

printf("Cannot open this file.\n");

exit(0);

}

printf("\nPLease shuru xiugai xuehao:");

scanf("%d",&i); getchar();

while((fread(&data,sizeof(data),1,fp))==1)

{

j=atoi(data.xuehao);

if(j==i)

{

printf("xuehao:%s\nmingzi:%s\n",data.xuehao,data.mingzi);

printf("Please shuru mingzi:");

gets(data.mingzi);

printf("Please shuru yuwen score:");

gets(temp);data.score[0]=atof(temp);

printf("Please shuru shuxue score:");

gets(temp);data.score[1]=atof(temp);

printf("Please input yingyu score:");

gets(temp);data.score[2]=atof(temp);

printf("Please input wuli score:");

gets(temp);data.score[3]=atof(temp);

printf("Please input huaxue score:");

gets(temp);data.score[4]=atof(temp);

data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];

} fwrite(&data,sizeof(data),1,fp1);

}

fseek(fp,0L,0);

fseek(fp1,0L,0);

while((fread(&data,sizeof(data),1,fp1))==1)

{

fwrite(&data,sizeof(data),1,fp);

}

fclose(fp);

fclose(fp1);

}

void chazhao()

{

if((fp=fopen("s_score.txt","rb"))==NULL)

{

printf("\nCannot open this file.\n");

exit(0);

}

printf("\nPLease shuru xuehao chakan:");

scanf("%d",&i);

while(fread(&data,sizeof(data),1,fp)==1)

{

j=atoi(data.xuehao);

if(i==j)

{

printf("xuehao:%s mingzi:%s\nyuwen:%f\n shuxue:%f\n yingyu:%f\n wuli:%f\n huaxue:%f\n ",data.xuehao,data.mingzi,data.score[0],data.score[1],data.score[2],data.score[3],data.score[4],data.score[5]);

}getch();

}

}

void shanchu()

{

if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)

{

printf("\nopen score.txt was failed!");

getch();

exit(0);

}

printf("\nPlease input ID which you want to del:");

scanf("%d",&i);getchar();

while((fread(&data,sizeof(data),1,fp))==1)

{

j=atoi(data.xuehao);

if(j==i)

{

printf("Anykey will delet it.\n");

getch();

continue;

}

fwrite(&data,sizeof(data),1,fp1);

}

fclose(fp);

fclose(fp1);

remove("s_score.txt");

rename("temp.txt","s_score.txt");

printf("Data delet was succesful!\n");

printf("Anykey will return to main.");

getch();

}

main()

{

while(1)

{

clrscr();

gotoxy(1,1);

textcolor(YELLOW);

textbackground(BLUE);

window(1,1,99,99);

clrscr();

printf("*************welcome to use student manage******************\n");

printf("*************************menu********************************\n");

printf("* ========================================================= * \n");

printf("* 1>shuru 2>xiugai * \n");

printf("* 3>shanchu 4>chazhao * \n");

printf("* 5>xianshi 6>exit * \n");

printf("* * \n");

printf("* --------------------------------------------------------- * \n");

printf(" Please input which you want(1-6):");

ch=getch();

switch(ch)

{

case '1':shuru();break;

case '2':xiugai(); break;

case '3':shanchu(); break;

case '4':chazhao(); break;

case '5':xianshi(); break;

case '6':exit(0);

default: continue;

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目 录 摘 要 2 第1章 需求分析 2 第2章 概要设计 2 2.1系统总体设计框架 2 2.2系统功能模块图 3 第3章 详细设计 6 第4章 主要源程序代码 7 第5章 调试分析过程描述 17 第6章 总结 19 参考文献 19 学生课程设计报告评分表 20 校际运动会管理系统 摘 要 本文介绍了利用C语言校际运动会管理系统进行设计的过程,从系统总体框架,功 能分析,模块设计与分析,类的设计与分析,功能测试等环节通过Microsoft Visual C++ 6.0对校际运动会管理系统进行详细的设计,并介绍了校际运动会管理系统如何运用,本 次设计是基于C语言的程序设计,利用了C语言的强大功能,设计出的程序运行良好,可 以在校际运动会管理系统等方面进行良好的运用。 关键词:C语言,班级档案管理系统,Microsoft Visual C++ 6.0 一、需求分析 (1)信息初始化 输入:N 参赛学校总数,M 男子竞赛项目数, W 女子竞赛项目数; 各项目名次取法有以下几种: 取前5名:第一名得分 7,第二名得分5,第三名得分3,第四名得分2,第五名得分1; 取前3名:第一名得分5,第二名得分3,第三名得分2; 用户自定义:各名次权值由用户指定。 (2)提醒用户填写比赛结果,输入各项目获奖运动员信息。 (3)所有信息记录完毕后,用户可以查询各个学校的比赛成绩,生成团体总分报表,察 看参赛学校信息和比赛项目信息等。 二、概要设计 分析整个系统,根据以上的需求分析及设计要求,可将整个系统的设计分为以下五个 模块:信息输入、录入比赛结果、查询信息、退出. 1. 系统总体设计框架 2. 系统功能模块图 各功能模块设计模块 信息输入模块 一是参赛学校信息,二是参赛运动员信息,三是比赛项目信息,分别输入并保存 void Information() { int n,w ; do { puts("\n\n\n"); puts("\t\t***^__^ Welcome to load 信息录入 system! ^__^***\n"); puts("\t\t*************************MENU*************************\n"); puts("\t\t******** 1.saveathlete **********\n"); puts("\t\t******** 2.saveschool **********\n"); puts("\t\t******** 3.saveprogram() **********\n"); puts("\t\t******** 4.back **********\n"); puts("\t\t***************************************\n"); printf("Choic your number(1-4):[ ]\b\b"); scanf("%d",&n); if (n<1""n>4) { w=1; getchar(); } else w=0; } while (w==1); switch(n) { case 1 : saveathlete(); break;// 保存运动员信息子函数 case 2 : saveschool(); break;//保存学校信息子函数 case 3 : saveprogram();break;//保存项目比赛信息子函数 case 4 : exit(0); } } 结果录入模块 (3)查询信息模块 [分析] 查询信息模块提供按不同方式查询各种信息机返回功能,其中各功能模块用菜单方式 选择。菜单部分也可写成函数。 3. 详细设计 1.主函数 主函数一般设计的较为简洁,只提供输入、功能处理和输出部分的函数调用。其中各 功能模块用菜单方式选择。另外菜单部分也可以写成函数。 2.流程图 [程序] void main() { menu(); } void menu() { int n,w1; do { puts("\t\t***^__^ Welcome to load sports system! ^__^***\n"); puts("\t\t************************MENU*************************\n"); puts("\t\t******** 1.Enter the information **************\n"); puts("\t\t******** 2.Score 比赛结果录入 **************\n"); puts("\t\t******** 3.Search **************\n"); puts("\t\t*******

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值