久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

057.運(yùn)動(dòng)會(huì)分?jǐn)?shù)統(tǒng)計(jì)

 C語(yǔ)言與CPP編程 2022-04-29 發(fā)布于安徽
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#define n 4
#define m 3
#define w 2

struct achievement  //定義表示成績(jī)的結(jié)構(gòu)體
{int schoolnumber;//學(xué)校編號(hào)
char name[20];	//姓名
int mark;	//分?jǐn)?shù)
int result;};

struct pro     //表示項(xiàng)目的結(jié)構(gòu)體
{int tag;//項(xiàng)目編號(hào)
struct achievement ach[5];
int number;};

struct Node         
{struct pro date;
struct Node *next;};


void ListInitiate(struct Node * *head)    //初始化單鏈表
{
    if((*head=(struct Node*)malloc(sizeof(struct Node)))==NULL) exit(1);
    (*head)->next=NULL;
}


void main()
{
    int i,j,t;
    int x[n]={0};int y[n]={0};
    struct Node *head;
    struct Node *p;
    struct Node *q;
    ListInitiate(&head);
    p=head;
	for(i=0;i<m+w;i++)      //輸入成績(jī)
    {
        j=i+1;
        printf("請(qǐng)輸入第%d個(gè)項(xiàng)目的信息\n",j);
        p->date.number=j;
        printf("所取的名次數(shù)為:");
        scanf("%d",&p->date.tag);
        while(p->date.tag!=3&&p->date.tag!=5)
        {printf("輸入有誤,請(qǐng)重新輸入!");
		printf("所取的名次數(shù)為:");
		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名的學(xué)校:",t);
            scanf("%d",&p->date.ach[t-1].schoolnumber);
            printf("第%d名的分?jǐn)?shù):",t);
            scanf("%d",&p->date.ach[t-1].mark);
            p->date.ach[t-1].result=t;
            t++;
        }
        q=(struct Node*)malloc(sizeof(struct Node));  //生成新結(jié)點(diǎn)
        p->next=q;
        p=q;
        p->next=NULL;
    }
	for(i=0;i<n;i++)     //產(chǎn)生成績(jī)單
	{
		j=i+1;
		printf("學(xué)校%d成績(jī)單\n",j);
		//t=1;
		p=head;
		do
		{
			t=1;
			while(t<=p->date.tag)
			{ 
				if(p->date.ach[t-1].schoolnumber==j)
				{            
					printf("獲獎(jiǎng)項(xiàng)目:%d   ",p->date.number);
					printf("名次:%d   \n",p->date.ach[t-1].result);
					printf("獲獎(jiǎng)人姓名:%s   ",p->date.ach[t-1].name);
					printf("所得分?jǐn)?shù):%d   ",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;
				}    
				t++;
			}
			p=p->next;
		}while(p!=NULL);
		printf("\n男子團(tuán)體總分:%d   ",x[i]);
		printf("女子團(tuán)體總分:%d   \n",y[i]);
		printf("\n團(tuán)體總分:%d\n",x[i]+y[i]);
	}
}

    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多