📄 update.h
字号:
#include "data.h"
#include "string.h"
void Update_Country();
void Update_Item();
void Update()
{
int chose;
printf ("\t\t\t1.跟新国家记录:\n");
printf ("\t\t\t2.跟新项目记录:\n");
printf ("\t\t\t3. 退出apliction:");
do{
printf ("\n\t\t\tEnter your choice(1~3):");
fflush (stdin);
scanf ("%d",&chose);
switch (chose)
{
case 1:
Update_Country();/*此函数--是根据金牌的数量排序*/
break;
case 2:
Update_Item();/*此函数--是根据国家的积分排序*/
break;
case 3:
exit(0);
break;/*退出此次操作*/
}
}while (chose<1||chose>3);
}
void Update_Country()
{
int i,j;
char GName[20];
printf ("Enter the Country Name\t");
fflush(stdin);
scanf ("%s",&GName);
for(i=0;i<N;i++)
{
if(strcmp(Country[i].GName,GName)==0)
{
j=i;
printf ("Enter the Num of Gold\t",i+1);
fflush(stdin);
scanf ("%d",&Country[j].Goldplate);
printf ("Enter the Num of Silver:\t",i+1);
fflush(stdin);
scanf ("%d",&Country[j].Silvermedal);
printf ("Enter the Num of Cupr:\t",i+1);
fflush(stdin);
scanf ("%d",&Country[j].Cuprumplate);
printf ("the Integral:\t%d\n",i+1,Country[j].Integral=Country[j].Goldplate*5+Country[j].Silvermedal*3+Country[j].Cuprumplate*2);
Sort_Goldplate();
}
else
{
printf("没有此国家的信息!\n");
}
}
}
void Update_Item()
{
int i,j;
char ItemName[20];
printf ("Enter the Name of Item\t");
fflush(stdin);
scanf ("%s",&ItemName);
for(i=0;i<M;i++)
{
if(strcmp(Item[i].ItemName,ItemName)==0)
{
j=i;
printf ("Enter the GoldAthleteName:\t");
fflush(stdin);
gets(Item[j].GoldAthleteName);
printf ("Enter the SilverAthleteName:\t");
fflush(stdin);
gets(Item[j].SilverAthleteName);
printf ("Enter the CuprAthleteName:\t");
fflush(stdin);
gets(Item[j].CuprAthleteName);
printf ("Enter the AthleteCity:\t");
fflush(stdin);
gets(Item[j].AthleteCity);
printf("\n");
}
else
{
printf("没有此项目信息\n");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -