⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rework.c

📁 一个c语言实现的球员管理系统
💻 C
字号:
#include"common.h"
void reworkMember(pInfoHead phead)
{
	char tempString[15];
	char choose;
	int int_temp;
	float float_temp;
	bool isExistMember;
	int items;
	Date date;
	pMEMBER pAmend=phead->next;
	pMEMBER ptempMember;
	printf("\n请输入要修改人员的编号(输入空行取消修改):");
	gets(tempString);
	if('\0'==tempString[0])
		return;
	while(NULL!=pAmend)
	{
		if(strcmpi(pAmend->number,tempString)==0)
			break;
		else
			pAmend=pAmend->next;
	}
	if(NULL==pAmend)
	{
		printf("\a未找到要修改的编号!");
		getch();
		return;
	}
	while(true)
	{
		CLS();
		printf("1st   "" 2nd           "" 3rd   "" 4th "" 5th    "" 6th    "" 7th       "" 8th    "" 9th     \n");
		showHeader(phead);
		printf("%-7s%-15s%-7s%-5d%-8.1f%-8.1f%-11s%-8d%04d-%02d-%02d\n",
			pAmend->number,pAmend->name,ROLE[pAmend->role],pAmend->age,
			pAmend->height,pAmend->weight,pAmend->nation,pAmend->salary,
			pAmend->joinTeamDate.year,
			pAmend->joinTeamDate.month,
			pAmend->joinTeamDate.day);
		printf("\n请选择要修改的项目对应的数字(0=返回):");
		do{
			while(strchr("1234567890",choose=getch())==NULL)
				continue;
		}while(0==choose);
		putchar('\n');
		switch(choose)
		{
		case'1':
			do
			{
				isExistMember=false;
				ptempMember=phead->next;
				printf("请输入修改后的编号(前6位非空白字符有效)[0=返回]:");
				scanf("%6s",tempString);		
				EatLine('\n');
				if(strcmp(tempString,"0")==0)
					return;
				while(NULL!=ptempMember)  //编号唯一性检验
				{
					if(strcmpi(ptempMember->number,tempString)==0)
					{
						printf("编号已存在!请重新输入!\n");
						isExistMember=true;
						break;
					}
					else
						ptempMember=ptempMember->next;
			    }
			}while(isExistMember);
			strcpy(pAmend->number,tempString);
			break;
		case'2':
			do
			{
				printf("请输入修改后的姓名(1~14位字符有效)[0=返回]: ");
				gets(tempString);
				if(strcmp(tempString,"0")==0)
					return;
			}while(strlen(tempString)>14||strlen(tempString)<1);
			strcpy(pAmend->name,tempString);
			break;
		case'3':
			puts("☆☆☆☆☆☆☆☆☆☆☆");
			puts("☆                  ☆");
			puts("☆     1.教练       ☆");
			puts("☆     2.前锋       ☆");
			puts("☆     3.中锋       ☆");
			puts("☆     4.后卫       ☆");
			puts("☆     5.守门员     ☆");
			puts("☆     0.返回       ☆");
			puts("☆                  ☆");
			puts("☆☆☆☆☆☆☆☆☆☆☆\n");
			printf("请选择修改后的角色:");	
			do{
				while(strchr("123450",choose=getch())==NULL)  //检测输入的选择字符的范围
					continue;
			}while(0==choose);
			if('0'==choose)
				return;
			putchar(choose);
			pAmend->role=choose-'0'-1;
			break;
		case'4':
			do
			{
				printf("请输入修改后的年龄[15~100](如:25)[0=返回]: ");
				items=scanf("%d",&int_temp);
				EatLine('\n');
				if(0==int_temp)
					return;
			}while(0==items||int_temp<15||int_temp>100);
			pAmend->age=int_temp;
			break;
		case'5':
			do
			{
				printf("请输入修改后的身高(cm)[150~250](如:175.5)[0=返回]: ");
				items=scanf("%f",&float_temp);
				EatLine('\n');
				if(float_temp-0<0.000001)
					return;
			}while(0==items||float_temp<150||float_temp>250);
			pAmend->height=float_temp;
			break;
		case'6':
			do
			{
				printf("请输入修改后的体重(kg)[40~150](如:70)[0=返回]: ");
				items=scanf("%f",&float_temp);
				EatLine('\n');
				if(float_temp-0<0.000001)
					return;
			}while(0==items||float_temp<40||float_temp>150);
			pAmend->weight=float_temp;	
			break;
		case'7':
			do
			{
				printf("请输其修改后的国籍(1~10位字符有效)[0=返回]: ");
				gets(tempString);
				if(strcmp(tempString,"0")==0)
					return;
			}while(strlen(tempString)>10||strlen(tempString)<1);
			strcpy(pAmend->nation,tempString);
			break;
		case'8':
			do
			{
				printf("请输入修改后的年薪(dollar)(如:120000)[0=返回]: ");
				items=scanf("%d",&int_temp);
				EatLine('\n');
				if(0==int_temp)
					return;
			}while(0==items||int_temp<0);                        //限定其薪水范围 (不低于0)dollar
			pAmend->salary=int_temp;
			break;
		case'9':
			do
			{
				printf("请输入队日期(正确格式:2007-09-10)[0=返回]:");
				items=scanf("%d-%d-%d",&date.year,&date.month,&date.day);
				if(getchar()!='\n')
				{
					items=0;
					EatLine('\n');
					continue;
				}
				EatLine('\n');
				if(0==date.year)
					return ;
			}while(items!=3 || !isRightFormat(&date));
			pAmend->joinTeamDate=date;
			break;
		case'0':return;
			break;
		}
		writeToFile(phead);
	}
	getch();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -