校运动编程
‘壹’ 比赛结果统计(用c++编程)
100分。。。编两个小时值了~~~
#include<iostream.h>
#include<string.h>
#include<ctype.h>
class School //学校
{
private:
char name[20];
int number;
int boy;
int girl;
public:
School *next;
void School_add();
void School_output(School *p);
int School_isexist(int a);
void School_show(int a);
void School_search(int a);
void School_addmark(int a,int b,int c);
void School_order(School *temp,int type);
};
class Sport //运动项目
{
private:
char name[20];
int isboy; //0为女项目,1为男项目
int is3; //0为取前五名,1为取前五名
int number; //项目编号
int first;
int second;
int third;
int fourth;
int fifth;
public:
Sport *next;
int Sport_isexist(int a);
void Sport_add();
void Sport_output(Sport *p);
void Sport_search(int a);
};
int getint(int a) //字符转换成数字
{
return (int)(a-'0');
}
School* head1; //定义俩个类指针
Sport* head2;
void School::School_add() //添加学校
{
School* p;
int mark=0;
p=new School;
cout<<"请输入学校的名称:";
cin>>p->name;
char c;
while (mark!=1)
{
cout<<"请输入学校的编号:";
cin>>c;
if (!isdigit(c))//是否为数字
{
cout<<"数据非法"<<endl;
}
else
{
mark=1;
p->number=c;
}
p->boy=0;
p->girl=0;
p->next=head1->next;
head1->next=p;
cout<<"成功添加了一个学校"<<endl;
cout<<"是否还要添加学校?(Y/N)"<<endl;
char input;
cin>>input;
switch(input)
{
case 'Y':
mark=0;
School_add();
case 'N':
mark=1;
return;
}
}
delete p;
}
void School::School_output(School *p)//输出学校
{
cout<<"当前学校(名称) 编号 总分\t\n";
p=head1;
p=p->next;
while(p)
{
cout<<p->name<<"\t\t"<<getint(p->number)<<"\t"<<" \t "<<(p->girl+p->boy)<<endl;
p=p->next;
}
}
int School::School_isexist(int a)//检验学校是否存在
{
int b=0;
School *p;
p=head1;
p=p->next;
while(p)
{
if(p->number==a)
{
return 1;
}
p=p->next;
}
return 0;
}
void School::School_show(int a)//输出所有学校
{
School *p;
p=head1;
p=p->next;
while(p)
{
if(p->number==a)
{
cout<<p->name<<" "<<endl;
return;
}
p=p->next;
}
cout<<"无";
}
void School::School_search(int a)//按编号搜索学校
{
School *p;
p=head1;
p=p->next;
while(p)
{
if(p->number==a)
{
cout<<"学校名称:"<<p->name<<" "<<"总分:"<<(p->boy+p->girl)<<" ";
return;
}
p=p->next;
}
cout<<"无此编号";
}
void School::School_addmark(int a,int b,int c)//a为分数,b为学校编号,c=1表示男,c=0表示女
{
School *p;
p=head1;
p=p->next;
while(p)
{
if(p->number==b)
{
if(c=='1')
{
p->boy=p->boy+a;
}
else
{
p->girl=p->girl+a;
}
}
p=p->next;
}
}
void School::School_order(School *temp,int type)
{
School* q,*small;
School* temp1;
temp1=new School;
temp1->next=NULL;
while(q&&small)
{
switch(type)
{
case 0: //按总分排序
for(q=head1;q=q->next;)
for(small=head1;small=small->next;)
{
if( (q->boy+q->girl)<(small->boy+small->girl) )
{
temp1->girl=q->girl;
q->girl=small->girl;
small->girl=temp1->girl;
temp1->boy=q->boy;
q->boy=small->boy;
small->boy=temp1->boy;
strcpy(temp1->name,q->name);
strcpy(q->name,small->name);
strcpy(small->name,temp1->name);
temp1->number=q->number;
q->number=small->number;
small->number=temp1->number;
}
}
break;
case 3: //按学校编号排序
for(q=head1;q=q->next;)
for(small=head1;small=small->next;)
{
if(q->number<small->number)
{
temp1->girl=q->girl;
q->girl=small->girl;
small->girl=temp1->girl;
temp1->boy=q->boy;
q->boy=small->boy;
small->boy=temp1->boy;
strcpy(temp1->name,q->name);
strcpy(q->name,small->name);
strcpy(small->name,temp1->name);
temp1->number=q->number;
q->number=small->number;
small->number=temp1->number;
}
}
break;
default:
cout<<"error"<<endl;
break;
}
}
}
int Sport::Sport_isexist(int a) //检查运动项目(编号)是否已经存在
{
int b=0;
Sport *p;
p=head2;
p=p->next;
while(p)
{
if(p->number==a)
{
return 1;
}
p=p->next;
}
return 0;
}
void Sport::Sport_add() //添加项目
{
Sport * p;
int mark=0;
p=new Sport;
cout<<"请输入项目名称:";
cin>>p->name;
char c;
while (mark!=1)
{
cout<<"请输入项目编号:";
cin>>c;
if (!isdigit(c))
{
cout<<"数据非法"<<endl;
}
else
{
if(Sport_isexist(c))
{
cout<<"该编号已存在"<<endl;
}
else
{
mark=1;
p->number=c;
}
}
}
mark=0;
while (mark!=1)
{
cout<<"请输入项目类型(0为女子项目,1为男子项目):";
cin>>c;
p->isboy=(int)(c-'0');//字符转换成数字
if (!isdigit(c))
{
cout<<"数据非法"<<endl;
}
else if(p->isboy<0||p->isboy>1)
{
cout<<"数据非法"<<endl;
}
else
{
mark=1;
p->isboy=c;
}
}
mark=0;
while (mark!=1)
{
cout<<"请输入项目名次情况(0为取前3名,1为取前5名):";
cin>>c;
p->is3=(int)(c-'0');
if (!isdigit(c))
{
cout<<"数据非法"<<endl;
}
else if(p->is3<0||p->is3>1)
{
cout<<"数据非法"<<endl;
}
else
{
mark=1;
p->is3=c;
}
}
mark=0;
School sh;
while (mark!=1)
{
cout<<"请输入第一名学校的编号:";
cin>>c;
if (!isdigit(c))
{
cout<<"数据非法"<<endl;
}
else
{
if(!sh.School_isexist(c))
{
cout<<"该学校不存在,请先添加";
}
else
{
mark=1;
p->first=c;
if(p->is3=='0')
sh.School_addmark(5,c,p->isboy);
else
sh.School_addmark(7,c,p->isboy);
}
}
}
mark=0;
while (mark!=1)
{
cout<<"请输入第二名学校的编号:";
cin>>c;
if (!isdigit(c))
{
cout<<"数据非法"<<endl;
}
else
{
if(!sh.School_isexist(c))
{
cout<<"该学校不存在,请先添加";
}
else
{
mark=1;
p->second=c;
if(p->is3=='0')
sh.School_addmark(3,c,p->isboy);
else
sh.School_addmark(5,c,p->isboy);
}
}
}
mark=0;
while (mark!=1)
{
cout<<"请输入第三名学校的编号:";
cin>>c;
if (!isdigit(c))
{
cout<<"数据非法"<<endl;
}
else
{
if(!sh.School_isexist(c))
{
cout<<"该学校不存在,请先添加";
}
else
{
mark=1;
p->third=c;
if(p->is3=='0')
sh.School_addmark(2,c,p->isboy);
else
sh.School_addmark(3,c,p->isboy);
}
}
}
mark=0;
if(p->is3=='1')
{
while (mark!=1)
{
cout<<"请输入第四名学校的编号:";
cin>>c;
if (!isdigit(c))
{
cout<<"数据非法"<<endl;
}
else
{
if(!sh.School_isexist(c))
{
cout<<"该学校不存在,请先添加";
}
else
{
mark=1;
p->fourth=c;
sh.School_addmark(2,c,p->isboy);
}
}
}
mark=0;
while (mark!=1)
{
cout<<"请输入第五名学校的编号:";
cin>>c;
if (!isdigit(c))
{
cout<<"数据非法"<<endl;
}
else
{
if(!sh.School_isexist(c))
{
cout<<"该学校不存在,请先添加"<<endl;
}
else
{
mark=1;
p->fifth=c;
sh.School_addmark(1,c,p->isboy);
}
}
}
}
else
{
p->fourth='0';
p->fifth='0';
}
p->next=head2->next;
head2->next=p;
cout<<"成功添加了一个运动项目"<<endl;
}
void Sport::Sport_output(Sport *p) //输出项目的情况
{
p=head2;
p=p->next;
cout<<"当前项目名称"<<"\t"<<"编号"<<" "<<"3/5"<<" "<<"第一名"<<" "
<<"第二名"<<" "<<"第三名"<<" "<<"第四名"<<" "<<"第五名"<<" "<<endl;
School sh;
while(p)
{
cout<<p->name<<"\t"<<" "<<getint(p->number)<<" " <<getint(p->isboy)<<" "<<getint(p->is3)<<" "<<" ";
sh.School_show(p->first);
sh.School_show(p->second);
sh.School_show(p->third);
sh.School_show(p->fourth);
sh.School_show(p->fifth);
p=p->next;
cout<<"\n";
}
cout<<endl;
}
void Sport::Sport_search(int a) //搜索项目
{
Sport *p;
School sh;
p=head2;
p=p->next;
while(p)
{
if(p->number==a)
{
cout<<"项目名:"<<p->name<<endl<<"项目类型:";
if(p->isboy==1)
{
cout<<"男子项目";
}
else
{
cout<<"女子项目";
}
cout<<endl<<"第一名:";
sh.School_show(p->first);
cout<<endl<<"第二名:";
sh.School_show(p->second);
cout<<endl<<"第三名:";
sh.School_show(p->third);
cout<<endl<<"第四名:";
sh.School_show(p->fourth);
cout<<endl<<"第五名:";
sh.School_show(p->fifth);
return;
}
p=p->next;
}
cout<<"无此编号";
}
void main() //主函数
{
head1=new School;
head1->next=NULL;
head2=new Sport;
head2->next=NULL;
School sh;
Sport sp;
School* p1;
Sport* p2;
p1=head1;
p1=p1->next;
p2=head2;
p2=p2->next;
char choose;
char temp;
int a=1;
while(a!=0)
{
cout<<" "<<endl;
cout<<" 欢迎使用比赛结果统计系统 "<<endl;
cout<<" ----------------------------------------------------------"<<endl;
cout<<" "<<endl;
cout<<" 注:输入运动项目之前请输入学校 "<<endl;
cout<<" -------请选择(0-6):------ "<<endl;
cout<<" 1.输入学校(输入N结束) 2.输入运动项目 "<<endl;
cout<<" 3.按学校编号输出总分 4.按学校总分排序 "<<endl;
cout<<" 5.按学校编号查询 6.按项目编号查询 "<<endl;
cout<<" 0.退出 "<<endl;
cout<<" "<<endl;
cout<<" ----------------------------------------------------------"<<endl;
cin>>choose;
if (!isdigit(choose))
{
cout<<"操作非法1"<<endl;
}
else
{
switch(getint(choose))
{
case 1:
sh.School_add();
break;
case 2:
sp.Sport_output(p2);
sh.School_output(p1);
sp.Sport_add();
break;
case 3:
sh.School_order(p1,3);
sh.School_output(p1);
break;
case 4:
sh.School_order(p1,0);
sh.School_output(p1);
break;
case 5:
cout<<"请输入学校编号:";
cin>>temp;
sh.School_search(temp);
break;
case 6:
cout<<"请输入项目编号:";
cin>>temp;
sp.Sport_search(temp);
break;
case 0:
a=0;
break;
default:
cout<<"操作非法\n";
}
}
}
}
‘贰’ c语言程序设计。。设计一个运动会管理系统,用于管理比赛时体操、跳水、滑冰等赛事裁判员对赛事的评分。
这需要找一个学过编程的来设计哦
‘叁’ 机器人编程和少儿编程有什么区别
机器人编程:机器人编程就是为使机器人完成某种任务而设置的动作顺序描述。机器人运动和作业的指令都是由程序进行控制,常见的编制方法有两种,示教编程方法和离线编程方法。其中示教编程方法包括示教、编辑和轨迹再现,可以通过示教盒示教和导引式示教两种途径实现。由于示教方式实用性强,操作简便,因此大部分机器人都采用这种方式。离线编程方法是利用计算机图形学成果,借助图形处理工具建立几何模型,通过一些规划算法来获取作业规划轨迹。与示教编程不同,离线编程不与机器人发生关系,在编程过程中机器人可以照常工作。
少儿编程:少儿编程教育是通过编程游戏启蒙、可视化图形编程等课程,培养学生的计算思维和创新解难能力的课程。一般来说,针对6-18岁的少年儿童开展的编程教育,现在,最常见的形式是线上和线下模式相结合的课外培训。根据先易后难的学习进程,少儿编程教学可以大致分为两类:一类是Scratch或是仿Scratch的图形化编程教学,以培养兴趣、锻炼思维为主,趣味性较强。在这里,可以创造属于自己的动画,故事,音乐和游戏,这个过程其实就像搭积木一样简单。
‘肆’ c语言编程,谢谢大家了!
#include<stdio.h>typedef struct{int xihao;char name[20];int num;int mingci;int socore;
}althete;void main(){ althete a[20]; int i,k=1,j; for(i=0;k==1;i++) { printf("请输入系号:\n"); scanf("%d",&a[i].xihao); printf("请输入姓名:\n"); scanf("%s",&a[i].name); printf("请输入运动项目编号:\n"); scanf("%d",&a[i].num); printf("请输入名次:\n"); scanf("%d",&a[i].mingci); a[i].socore=0; if(a[i].mingci==1) a[i].socore+=7; else if(a[i].mingci==2) a[i].socore+=5; else if(a[i].mingci==3) a[i].socore+=3; else if(a[i].mingci==4) a[i].socore+=2; else if(a[i].mingci=5) a[i].socore+=1;
printf("输入完成,是否继续输入?若继续请按1,否按2"); scanf("%d",&j); if(j==1) k=1; else k=0;
} althete xx; for(int n=1;n<i;n++) { for(j=0;j<i-n;j++) if(a[j].socore<a[j+1].socore) { xx=a[j]; a[j]=a[j+1]; a[j+1]=xx; } } for(j=0;j<i;j++) { printf("%d\n",a[j].xihao); printf("%d\n",a[j].socore); printf("\n\n\n"); }}
我暂时只能写这么多了,没空了
留给你参考参考吧!
‘伍’ 校际运动会管理系统C++程序设计
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <conio.h>
#define n 5 /*设定,可更改*/
#define m 3 /*设定,可更改*/
#define w 2 /*设定,可更改*/
struct achievement /* 定义表示成绩的结构体 */
{int schoolnumber;/* 学校编号 */
char name[20]; /* 姓名 */
int mark; /* 分数 */
int result;};
struct pro /* 表示项目的结构体 */
{int tag;/* 项目编号 */
struct achievement ach[m+w];
int number;
};
struct Node
{struct pro date;
struct Node *next;
};
main()
{
int i,j,t;
int x[n]={0};int y[n]={0}; /* x[n]和y[n]分别表示男子和女子团体总分 */
struct Node *head;
struct Node *p;
struct Node *q;
if((head=(struct Node*)malloc(sizeof(struct Node)))==NULL) exit(1);
head->next=NULL; /* 初始化单链表 */
p=head;
for(i=0;i<m+w;i++) /* 输入成绩 */
{
j=i+1;
printf("请输入第%d个项目的信息\n",j);
p->date.number=j;
printf("所取的名次数为:");
scanf("%d",&p->date.tag);
while(p->date.tag!=3&&p->date.tag!=5)
{ printf("输入有误,请重新输入!");
getchar(); /*加入此函数避免输入错误时程序进入无限循环*/
getchar();
printf("所取的名次数为:");
scanf("%d",&p->date.tag);
}
t=1;
while(t<=p->date.tag)
{
printf("第%d名的名字:",t);
scanf("%s",p->date.ach[t-1].name);
printf("第%d名的学校:",t);
scanf("%d",&p->date.ach[t-1].schoolnumber);
printf("第%d名的分数:",t);
scanf("%d",&p->date.ach[t-1].mark);
p->date.ach[t-1].result=t;
t++;
}
if(j!=m+w)/* 注意这里 */
{q=(struct Node*)malloc(sizeof(struct Node)); /* 生成新结点 */
p->next=q;
p=q;
p->next=NULL;
}
}
for(i=0;i<n;i++) /* 产生成绩单 */
{
j=i+1;
printf("\n学校%d成绩单:\n",j);
p=head;
while(p!=NULL)
{
t=1;
while(t<=p->date.tag)
{
if(p->date.ach[t-1].schoolnumber==j)
{
printf("获奖项目:%d ",p->date.number);
printf("名次:%d ",p->date.ach[t-1].result);
printf("获奖人姓名:%s ",p->date.ach[t-1].name);
printf("所得分数:%d \n",p->date.ach[t-1].mark);
if(p->date.number<=m)
x[i]=x[i]+p->date.ach[t-1].mark;
else
y[i]=y[i]+p->date.ach[t-1].mark;
}
‘陆’ java编程.现有如下学生参加学校运动会
遍历,String有个方法是startWith
‘柒’ 你好我是初学者只会一些简单的c语言编程。学校运动管理系统我没接触过不知道怎么做,你能把你做的给我看吗
一个完整的系统,并不是一个人能够完成的。因为它需要我们懂得许多方面的知识,一个人很难掌握这些的。在做系统前还需要可行性分析、需求分析等耗时但很关键的步骤,这些决定了你的系统是否能够顺利完成正常工作。所以如果你需要做该系统,就该多召集一些有这方面能力的人,合理分配任务,达到较高质量的完成任务。
‘捌’ C语言课程设计~~~ 要求编写一段程序,题目是《校际运动会管理系统》
我这是源代码已经调试过了,在VC++上运行成功了。
#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<i;j++,k++)
{
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;
}
}
‘玖’ C语言程序设计运动会成绩管理系统(我想要的是第3题的!!)
额 就两种情况嘛! 到了 或者没有到! 晕死! 在计算机中0是假1是真
只有两种情况! 随便定义一下判断一下再输出就行!
‘拾’ C++编程,是校园运动会系统管理,一定的是C++的,不能用C语言,要求如下:
一个系统管理的软件,代码量很大!使用C++的意思是要使用创建相关的类处理问题,而不是简单面向过程处理。这个帮不了你,因为代码量真的太多了,而且很费时间。没人愿意重头帮你做的。