用c语言写一个全面的学生管理系统变名

实现的功能

1、 学生管理的基本功能
2、新增加
a、多条件查询(可根据编号、称号、总体战力、组织度以及数组-坦克、武直、步兵这七项查询)
b、在编号、称号输错时候可以返回上一步重新输入编号、称号
c、新增加一个模块比对,可在实现上述功能的同时比对总体战力
d、新模块还可以对数组-坦克、武直、步兵这三项的值单独比对
e、可在排序功能模块输出战力最高的值是谁
f、可以输入设置密码,密码输错会报错,错三次则会退出程序
g、实现了可以将输入的数据存储为二进制文件并读取的功能
h、实现了各模块颜色的切换

代码

因为代码过多,先写源代码再展示模块

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
#define N 100
#define M 3
#define Esc 27
#define K 3
int listnum = 0;
struct student
{
	char num[8];
	char name[8];
	float score[M];
	float total;
	float avr;
}stu[N];
void listcount()
{
	FILE* fp;
	struct student temp;
	if ((fp = fopen("date", "rb")) == NULL)
	{
		printf("\n\n\t对不起,无法打开文件,请先输入学生信息\n");
		return;
	}
	while (!feof(fp))
	{
		fread(&temp, sizeof(struct student), 1, fp);
		listnum++;
	}
	listnum--;
	fclose(fp);
}
void menu()
{
	system("color 6f");
	system("cls");
	printf("\n\n\t\t   = = = = = = = = = = = = = = = = = ");
	printf("\n\n\t\t   = =欢迎使用战争管理系统= = =");
	printf("\n\n\t\t   = = = = = = = = = = = = = = = = = ");
	printf("\n\n\t\t   1、军备详情录入");
	printf("\n\n\t\t   2、军备详情输出");
	printf("\n\n\t\t   3、军备详情排序");
	printf("\n\n\t\t   4、多条件查找军备详情");
	printf("\n\n\t\t   5、多条件修改军备详情");
	printf("\n\n\t\t   6、多条件删除军备详情");
	printf("\n\n\t\t   7、多条件比对部队实力");
	printf("\n\n\t\t   Esc 退出程序");
	printf("\n\n\t\t   --------------------------------------");
	printf("\n\n\t\t   指挥官,请您输入操作选项: ");
}
void exit1()
{
	system("color 1d");
	system("cls");
	printf("\n\n\n\n\n\n\n\n\t\t感谢使用战争管理系统!\n\n\n\n");
	printf("\n\n\n\n\n\n\n\n\t\t祝您武运昌隆!07\n\n\n\n");
	printf("*******************按任意键退出*****************\n");
}
void input()
{

	int flag = 1, i = 0, j = 0, m = 0;
	char c;
	FILE* fp;
	fp = fopen("date", "ab");
	system("color 7c");
	system("cls");
	printf("\n\n\n\n\t==========欢迎来到战争管理录入系统========\n\n");
	do
	{
		printf("\n\n\n\t\t请输入战备信息:\n\n");
	error:
		printf("\t请输入军队编号");
		scanf("%s", stu[i].num);
		printf("\t请输入军队称号");
		scanf("%s", stu[i].name);
		printf("有误请打1,没有请打2\n");
		scanf("%d", &m);
		if (m == 1)
			goto error;
		//system("cls");
		stu[i].total = 0;
		for (j = 0; j < M; j++)
		{
			printf("\t请输入%s数量:", j == 0 ? "坦克" : j == 1 ? "武装直升机" : j == 2 ? "机械化步兵" : "有误");
			scanf("%f", &stu[i].score[j]);
			stu[i].total = stu[i].total + stu[i].score[j];
		}
		stu[i].avr = stu[i].total / 3;
		i++; listnum++;
		printf("是否继续输入战备信息(Y/N)");
		while (1)
		{
			c = getch();
			if (c == 'Y' || c == 'y') flag = 1;
			if (c == 'N' || c == 'n')flag = 0;
			if (c == 'N' || c == 'Y' || c == 'y' || c == 'n')break;
		}
		system("cls");
	} while (flag == 1);
	for (i = 0; i < listnum; i++)
		fwrite(&stu[i], sizeof(struct student), 1, fp);
	fclose(fp);
}
void output()
{

	int i, j;
	FILE* fp;
	fp = fopen("date", "rb");
	for (i = 0; i < listnum; i++)

		fread(&stu[i], sizeof(struct student), 1, fp);
	fclose(fp);

	system("color 2b");
	system("cls");
	printf("\n\n\n****************帝国战备信息表*********************\n\n");
	printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
	for (i = 0; i < listnum; i++)
	{

		printf("%-8s%-10s", stu[i].num, stu[i].name);
		for (j = 0; j < M; j++)

			printf("%-9.2f", stu[i].score[j]);
		printf("%-9.2f", stu[i].total);
		printf("%-9.2f\n", stu[i].avr);


	}
	printf("\n\n\n**************按任意键返回主界面*************\n\n");
	getch();


}
void sort()
{
	int i, j, k;
	struct student temp;
	FILE* fp;
	fp = fopen("date", "rb");
	for (i = 0; i < listnum; i++)
		fread(&stu[i], sizeof(struct student), 1, fp);
	fclose(fp);
	system("color 1e");
	system("cls");
	for (i = 0; i < listnum - 1; i++)
	{
		k = i;
		for (j = i + 1; j < listnum; j++)
			if (stu[i].total < stu[j].total)k = j;
		temp = stu[i];
		stu[i] = stu[k];
		stu[k] = temp;
	}
	printf("\n \n\n\t排序后的帝国战备信息如下: \n\n\n");
	printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
	for (i = 0; i < listnum; i++)
	{
		printf("%-8s%-10s", stu[i].num, stu[i].name);
		for (j = 0; j < M; j++)

			printf("%-9.2f", stu[i].score[j]);
		printf("%-9.2f", stu[i].total);
		printf("%-9.2f\n", stu[i].avr);


	}
	printf("最强战力是 %f", stu[0].total);
	printf("\n\n\n**************按任意键返回主界面*************\n\n");
	getch();

}
void search()
{
	int i, j, flag = 1, ifsearch = 0, afsearch = 0;
	char  name[8], c, d;
	float cnn;
	float dhcp[K];

	FILE* fp;
	fp = fopen("date", "rb");
	for (i = 0; i < listnum; i++)
		fread(&stu[i], sizeof(struct student), 1, fp);
	fclose(fp);
	system("color 85");
	system("cls");
	printf("\n\n\n\n\t==========欢迎来到战争管理查询系统========\n\n");
	while (flag == 1)
	{
		printf("\n\t请选择查询条件,输入a可以按照编号/称号查询,输入b可以按照总体战力/组织度查询,c可以按照战备数量查询\n");
		getchar();
		scanf("%c", &d);
		if (d == 'a' || d == 'A')
		{
			printf("\n\t请您输入要查找的部队编号/称号后敲回车");
			scanf("%s", &name);
			for (i = 0; i < listnum; i++)
			{
				if (strcmp(name, stu[i].name) == 0)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
				}
				else if (strcmp(name, stu[i].num) == 0)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
				}

			}
			if (ifsearch == 0)
			{
				printf("\n\n\t抱歉您输入的部队编号/称号有误");
			}
		}
		//else { printf("\n\n\t抱歉您查找的学生不存在"); }
		if (d == 'b' || d == 'B')
		{
			printf("\n\t请您输入要查找的部队总体战力/组织度查询后敲回车");
			scanf("%f", &cnn);
			for (i = 0; i < listnum; i++)
			{
				if (fabs(cnn - stu[i].total) < 1e-6)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
				}
				else if (fabs(cnn - stu[i].avr) < 1e-6)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
				}
				//else { printf("\n\n\t抱歉您查找的学生不存在"); }
			}
			if (ifsearch == 0)
			{
				printf("\n\n\t抱歉您输入的部队总体战力/组织度有误");
			}
		}
		//else { printf("\n\n\t抱歉您查找的学生不存在"); }
		if (d == 'c' || d == 'C')
		{
			printf("\n\t请您输入要查找的部队战备数量查询后敲回车(查询坦克请输入d,查询武装直升机请输入e,查询机械化步兵请输入f)\n");
			getchar();
			scanf("%c", &d);
			if (d == 'd' || d == 'D')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{



					printf("\t请输入坦克数量:");
					scanf("%f", &dhcp[0]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;


					for (i = 0; i < listnum && ifsearch != 1; i++)
					{
						if (fabs(dhcp[0] - stu[i].score[0]) < 1e-6)
						{
							//ifsearch = 1;
							printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
							printf("%-8s%-10s", stu[i].num, stu[i].name);
							for (j = 0; j < M; j++)
								printf("%-9.2f", stu[i].score[j]);
							printf("%-9.2f", stu[i].total);
							printf("%-9.2f\n", stu[i].avr);

							ifsearch = 1;
							/*afsearch = 1;*/
							//break;
						}


					}
					/*if (afsearch == 1)
					{
						break;
						printf("\n\n\t抱歉您输入的学生成绩有误");
					}
				   */
				   //else { printf("\n\n\t抱歉您要查询的学生不存在"); }
				}
			}
			if (d == 'e' || d == 'E')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{



					printf("\t请输入武装直升机数量:");
					scanf("%f", &dhcp[1]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;


					for (i = 0; i < listnum && ifsearch != 1; i++)
					{
						if (fabs(dhcp[1] - stu[i].score[1]) < 1e-6)
						{
							//ifsearch = 1;
							printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
							printf("%-8s%-10s", stu[i].num, stu[i].name);
							for (j = 0; j < M; j++)
								printf("%-9.2f", stu[i].score[j]);
							printf("%-9.2f", stu[i].total);
							printf("%-9.2f\n", stu[i].avr);

							ifsearch = 1;
							/*afsearch = 1;*/
							//break;
						}


					}

				}
			}
			if (d == 'f' || d == 'F')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{



					printf("\t请输入机械化步兵数量:");
					scanf("%f", &dhcp[2]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;


					for (i = 0; i < listnum && ifsearch != 1; i++)
					{
						if (fabs(dhcp[2] - stu[i].score[2]) < 1e-6)
						{
							//ifsearch = 1;
							printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
							printf("%-8s%-10s", stu[i].num, stu[i].name);
							for (j = 0; j < M; j++)
								printf("%-9.2f", stu[i].score[j]);
							printf("%-9.2f", stu[i].total);
							printf("%-9.2f\n", stu[i].avr);

							ifsearch = 1;
							/*afsearch = 1;*/
							//break;
						}


					}

				}
			}
			if (ifsearch == 0)
			{
				printf("\t\t抱歉您查找的部队不存在");
			}
		}
		//else { printf("抱歉您查找的学生不存在"); }

		//if ("ifsearch==0") printf("抱歉您查找的学生不存在");
		printf("\n\n\n\t是否继续?(Y/N)");
		while (1)
		{
			c = getch();
			if (c == 'y' || c == 'Y') { flag = 1; ifsearch = 0; }
			if (c == 'n' || c == 'N') flag = 0;
			if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
		}
	}

}
void change()
{
	int i, j, flag = 1, ifsearch = 0;
	char  name[8], c, d;
	float cnn;
	float dhcp[K];

	FILE* fp;
	fp = fopen("date", "rb");
	for (i = 0; i < listnum; i++)
		fread(&stu[i], sizeof(struct student), 1, fp);
	fclose(fp);
	system("color d7");
	system("cls");
	printf("\n\n\n\n\t==========欢迎来到战争管理修改系统========\n\n");
	while (flag == 1)
	{
		printf("\n\t请选择查询条件,输入a可以进行编号/称号查询,输入b可以按照总体战力/组织度查询,输入c可以按照部队战备数量查询\n");
		getchar();
		scanf("%c", &d);
		if (d == 'a' || d == 'A')
		{
			printf("\n\t请您输入要修改的部队编号/称号后敲回车");
			scanf("%s", &name);
			for (i = 0; i < listnum; i++)
			{

				if (strcmp(name, stu[i].name) == 0)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
					printf("\n\n\t确定修改该部队信息?(y/n)");
					while (1)
					{
						c = getch();
						if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
						if (c == 'n' || c == 'N') flag = 0;
						if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
					}
					if (flag == 1)
					{
						printf("\t请输入要修改部队的战备信息");
						//scanf("%s", stu[i].name);
						stu[i].total = 0;
						for (j = 0; j < M; j++)
						{
							printf("\t请输入%s数量:", j == 0 ? "坦克" : j == 1 ? "武装直升机" : j == 2 ? "机械化步兵" : "错误");
							scanf("%f", &stu[i].score[j]);
							stu[i].total = stu[i].total + stu[i].score[j];
						}
						stu[i].avr = stu[i].total / 3;
						printf("\n\n\t\t修改成功");
					}
				}
				else if (strcmp(name, stu[i].num) == 0)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
					printf("\n\n\t确定修改该部队信息?(y/n)");
					while (1)
					{
						c = getch();
						if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
						if (c == 'n' || c == 'N') flag = 0;
						if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
					}
					if (flag == 1)
					{
						printf("\t请输入要修改部队的战备信息");
						//scanf("%s", stu[i].name);
						stu[i].total = 0;
						for (j = 0; j < M; j++)
						{
							printf("\t请输入%s数量:", j == 0 ? "坦克" : j == 1 ? "武装直升机" : j == 2 ? "机械化步兵" : "错误");
							scanf("%f", &stu[i].score[j]);
							stu[i].total = stu[i].total + stu[i].score[j];
						}
						stu[i].avr = stu[i].total / 3;
						printf("\n\n\t\t修改成功");
					}
				}
				//else { printf("\n\n\t抱歉您要修改的学生不存在"); }
			}
			if (ifsearch == 0)
			{
				printf("\n\n\t抱歉您输入的部队战备有误");
			}

		}
		//else { printf("抱歉您要修改的学生不存在"); }
		if (d == 'b' || d == 'B')
		{
			printf("\n\t请您输入要修改的部队总体战力/组织度查询后敲回车");
			scanf("%f", &cnn);
			for (i = 0; i < listnum; i++)
			{
				if (fabs(cnn - stu[i].total) < 1e-6)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
					printf("\n\n\t确定修改该部队信息?(y/n)");
					while (1)
					{
						c = getch();
						if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
						if (c == 'n' || c == 'N') flag = 0;
						if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
					}
					if (flag == 1)
					{
						printf("\t请输入要修改部队的战备信息");
						//scanf("%s", stu[i].name);
						stu[i].total = 0;
						for (j = 0; j < M; j++)
						{
							printf("\t请输入%s数量:", j == 0 ? "坦克" : j == 1 ? "武装直升机" : j == 2 ? "机械化步兵" : "错误");
							scanf("%f", &stu[i].score[j]);
							stu[i].total = stu[i].total + stu[i].score[j];
						}
						stu[i].avr = stu[i].total / 3;
						printf("\n\n\t\t修改成功");
					}
				}
				else if (fabs(cnn - stu[i].avr) < 1e-6)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
					printf("\n\n\t确定修改该部队信息?(y/n)");
					while (1)
					{
						c = getch();
						if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
						if (c == 'n' || c == 'N') flag = 0;
						if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
					}
					if (flag == 1)
					{
						printf("\t请输入要修改部队的战备信息");
						//scanf("%s", stu[i].name);
						stu[i].total = 0;
						for (j = 0; j < M; j++)
						{
							printf("\t请输入%s数量:", j == 0 ? "坦克" : j == 1 ? "武装直升机" : j == 2 ? "机械化步兵" : "错误");
							scanf("%f", &stu[i].score[j]);
							stu[i].total = stu[i].total + stu[i].score[j];
						}
						stu[i].avr = stu[i].total / 3;
						printf("\n\n\t\t修改成功");
					}
				}
				//else { printf("\n\n\t抱歉您要修改的学生不存在"); }
			}
			if (ifsearch == 0)
			{
				printf("\n\n\t抱歉您输入的部队信息有误");
			}
		}
		//else { printf("抱歉您要修改的学生不存在"); }
		if (d == 'c' || d == 'C')
		{
			printf("\n\t请您输入要修改的部队信息查询后敲回车(修改坦克请输入d,修改武装直升机请输入e,修改机械化步兵请输入f)\n");
			getchar();
			scanf("%c", &d);
			if (d == 'd' || d == 'D')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{
					printf("\t请输入坦克:");
					scanf("%f", &dhcp[0]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;

					for (i = 0; i < listnum && ifsearch != 1; i++)
					{
						if (fabs(dhcp[0] - stu[i].score[0]) < 1e-6)
						{
							//ifsearch = 1;
							printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
							printf("%-8s%-10s", stu[i].num, stu[i].name);
							for (j = 0; j < M; j++)
								printf("%-9.2f", stu[i].score[j]);
							printf("%-9.2f", stu[i].total);
							printf("%-9.2f\n", stu[i].avr);
							ifsearch = 1;
							printf("\n\n\t确定修改该部队信息?(y/n)");
							while (1)
							{
								c = getch();
								if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
								if (c == 'n' || c == 'N') flag = 0;
								if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
							}
							if (flag == 1)
							{
								printf("\t请输入要修改部队的战备信息");
								//scanf("%s", stu[i].name);
								stu[i].total = 0;
								for (j = 0; j < M; j++)
								{
									printf("\t请输入%s数量:", j == 0 ? "坦克" : j == 1 ? "武装直升机" : j == 2 ? "机械化步兵" : "错误");
									scanf("%f", &stu[i].score[j]);
									stu[i].total = stu[i].total + stu[i].score[j];
								}
								stu[i].avr = stu[i].total / 3;
								printf("\n\n\t\t修改成功");
							}
						}
					}
				}
			}
			if (d == 'e' || d == 'E')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{
					printf("\t请输入武装直升机:");
					scanf("%f", &dhcp[1]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;

					for (i = 0; i < listnum && ifsearch != 1; i++)
					{
						if (fabs(dhcp[1] - stu[i].score[1]) < 1e-6)
						{
							//ifsearch = 1;
							printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
							printf("%-8s%-10s", stu[i].num, stu[i].name);
							for (j = 0; j < M; j++)
								printf("%-9.2f", stu[i].score[j]);
							printf("%-9.2f", stu[i].total);
							printf("%-9.2f\n", stu[i].avr);
							ifsearch = 1;
							printf("\n\n\t确定修改该部队信息?(y/n)");
							while (1)
							{
								c = getch();
								if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
								if (c == 'n' || c == 'N') flag = 0;
								if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
							}
							if (flag == 1)
							{
								printf("\t请输入要修改部队的战备信息");
								//scanf("%s", stu[i].name);
								stu[i].total = 0;
								for (j = 0; j < M; j++)
								{
									printf("\t请输入%s数量:", j == 0 ? "坦克" : j == 1 ? "武装直升机" : j == 2 ? "机械化步兵" : "错误");
									scanf("%f", &stu[i].score[j]);
									stu[i].total = stu[i].total + stu[i].score[j];
								}
								stu[i].avr = stu[i].total / 3;
								printf("\n\n\t\t修改成功");
							}
						}
					}
				}
			}
			if (d == 'f' || d == 'F')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{
					printf("\t请输入机械化步兵:");
					scanf("%f", &dhcp[2]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;

					for (i = 0; i < listnum && ifsearch != 1; i++)
					{
						if (fabs(dhcp[2] - stu[i].score[2]) < 1e-6)
						{
							//ifsearch = 1;
							printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
							printf("%-8s%-10s", stu[i].num, stu[i].name);
							for (j = 0; j < M; j++)
								printf("%-9.2f", stu[i].score[j]);
							printf("%-9.2f", stu[i].total);
							printf("%-9.2f\n", stu[i].avr);
							ifsearch = 1;
							printf("\n\n\t确定修改该部队信息?(y/n)");
							while (1)
							{
								c = getch();
								if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
								if (c == 'n' || c == 'N') flag = 0;
								if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
							}
							if (flag == 1)
							{
								printf("\t请输入要修改部队的战备信息");
								//scanf("%s", stu[i].name);
								stu[i].total = 0;
								for (j = 0; j < M; j++)
								{
									printf("\t请输入%s数量:", j == 0 ? "坦克" : j == 1 ? "武装直升机" : j == 2 ? "机械化步兵" : "错误");
									scanf("%f", &stu[i].score[j]);
									stu[i].total = stu[i].total + stu[i].score[j];
								}
								stu[i].avr = stu[i].total / 3;
								printf("\n\n\t\t修改成功");
							}
						}
					}
				}
			}
			if (ifsearch == 0)
			{
				printf("\n\n\t抱歉您输入的部队信息有误");
			}

			//else { printf("\n\n\t抱歉您要修改的学生不存在"); }
		}
		//else { printf("抱歉您要修改的学生不存在"); }
		//if ("ifsearch==0") printf("抱歉您查找的学生不存在");
		printf("\n\n\n\t是否继续?(Y/N)");
		while (1)
		{
			c = getch();
			if (c == 'y' || c == 'Y') { flag = 1; ifsearch = 0; }
			if (c == 'n' || c == 'N') flag = 0;
			if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
		}
	}
	fp = fopen("date", "wb");
	for (i = 0; i < listnum; i++)
		fwrite(&stu[i], sizeof(struct student), 1, fp);
	fclose(fp);
}
void del()
{
	int i, j, flag = 1, member = 0, ifsearch = 0;
	char  name[8], c, d;
	float cnn;
	float dhcp[K];

	FILE* fp;
	fp = fopen("date", "rb");
	for (i = 0; i < listnum; i++)
		fread(&stu[i], sizeof(struct student), 1, fp);
	fclose(fp);
	system("color f0");
	system("cls");
	printf("\n\n\n\n\t==========欢迎来到战争管理删除系统========\n\n");
	while (flag == 1)
	{
		printf("\n\t请选择查询条件,输入a可以进行编号/称号查询,输入b可以按照总体战力/组织度,输入c可以按照部队战备数量查询\n");
		getchar();
		scanf("%c", &d);
		if (d == 'a' || d == 'A')
		{
			printf("\n\t请您输入要删除的部队编号/称号后敲回车");
			scanf("%s", &name);
			for (i = 0; i < listnum; i++)
			{
				if (strcmp(name, stu[i].name) == 0)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
					printf("\n\n\t确定删除该部队信息?(y/n)");
					while (1)
					{
						c = getch();
						if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
						if (c == 'n' || c == 'N') flag = 0;
						if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
					}
					if (flag == 1)
					{
						for (j = 0; j < listnum - 1; j++)
							stu[j] = stu[j + 1];
						member++;
						printf("\n\n\t\t删除成功");
					}
				}
				else if (strcmp(name, stu[i].num) == 0)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
					printf("\n\n\t确定删除该部队信息?(y/n)");
					while (1)
					{
						c = getch();
						if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
						if (c == 'n' || c == 'N') flag = 0;
						if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
					}
					if (flag == 1)
					{

						for (j = 0; j < listnum - 1; j++)
							stu[j] = stu[j + 1];
						member++;
						printf("\n\n\t\t删除成功");
					}
				}
				//else { printf("\n\n\t抱歉您要删除的学生不存在"); }
			}
			if (ifsearch == 0)
			{
				printf("\n\n\t抱歉您输入的部队信息有误");
			}
		}
		//else { printf("抱歉您要删除的学生不存在"); }
		if (d == 'b' || d == 'B')
		{
			printf("\n\t请您输入要删除的学生总体战力/组织度查询后敲回车");
			scanf("%f", &cnn);
			for (i = 0; i < listnum; i++)
			{
				if (fabs(cnn - stu[i].total) < 1e-6)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
					printf("\n\n\t确定删除该部队信息?(y/n)");
					while (1)
					{
						c = getch();
						if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
						if (c == 'n' || c == 'N') flag = 0;
						if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
					}
					if (flag == 1)
					{

						for (j = 0; j < listnum - 1; j++)
							stu[j] = stu[j + 1];
						member++;
						printf("\n\n\t\t删除成功");
					}
				}
				else if (fabs(cnn - stu[i].avr) < 1e-6)
				{
					//ifsearch = 1;
					printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
					printf("%-8s%-10s", stu[i].num, stu[i].name);
					for (j = 0; j < M; j++)
						printf("%-9.2f", stu[i].score[j]);
					printf("%-9.2f", stu[i].total);
					printf("%-9.2f\n", stu[i].avr);
					ifsearch = 1;
					printf("\n\n\t确定删除该部队信息?(y/n)");
					while (1)
					{
						c = getch();
						if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
						if (c == 'n' || c == 'N') flag = 0;
						if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
					}
					if (flag == 1)
					{

						for (j = 0; j < listnum - 1; j++)
							stu[j] = stu[j + 1];
						member++;
						printf("\n\n\t\t删除成功");
					}
				}
				//else { printf("\n\n\t抱歉您要修改的学生不存在");}
			}
			if (ifsearch == 0)
			{
				printf("\n\n\t抱歉您输入的部队信息有误");
			}
		}
		//else { printf("抱歉您要删除的学生不存在"); }
		if (d == 'c' || d == 'C')
		{
			printf("\n\t请您输入要删除的部队信息查询后敲回车(坦克请输入d,武装直升机请输入e,机械化步兵请输入f)\n");
			getchar();
			scanf("%c", &d);
			if (d == 'd' || d == 'D')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{
					printf("\t请输入坦克:");
					scanf("%f", &dhcp[0]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;


					for (i = 0; i < listnum && ifsearch != 1; i++)
					{

						if (fabs(dhcp[0] - stu[i].score[0]) < 1e-6)
						{
							//ifsearch = 1;
							printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
							printf("%-8s%-10s", stu[i].num, stu[i].name);
							for (j = 0; j < M; j++)
								printf("%-9.2f", stu[i].score[j]);
							printf("%-9.2f", stu[i].total);
							printf("%-9.2f\n", stu[i].avr);
							ifsearch = 1;
							printf("\n\n\t确定删除该部队信息?(y/n)");
							while (1)
							{
								c = getch();
								if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
								if (c == 'n' || c == 'N') flag = 0;
								if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
							}
							if (flag == 1)
							{

								for (j = 0; j < listnum - 1; j++)
									stu[j] = stu[j + 1];
								member++;
								printf("\n\n\t\t删除成功");
							}
						}
					}
				}
			}
			if (d == 'e' || d == 'E')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{
					printf("\t请输入武装直升机:");
					scanf("%f", &dhcp[1]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;


					for (i = 0; i < listnum && ifsearch != 1; i++)
					{

						if (fabs(dhcp[1] - stu[i].score[1]) < 1e-6)
						{
							//ifsearch = 1;
							printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
							printf("%-8s%-10s", stu[i].num, stu[i].name);
							for (j = 0; j < M; j++)
								printf("%-9.2f", stu[i].score[j]);
							printf("%-9.2f", stu[i].total);
							printf("%-9.2f\n", stu[i].avr);
							ifsearch = 1;
							printf("\n\n\t确定删除该部队信息?(y/n)");
							while (1)
							{
								c = getch();
								if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
								if (c == 'n' || c == 'N') flag = 0;
								if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
							}
							if (flag == 1)
							{

								for (j = 0; j < listnum - 1; j++)
									stu[j] = stu[j + 1];
								member++;
								printf("\n\n\t\t删除成功");
							}
						}
					}
				}
			}
			if (d == 'f' || d == 'F')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{
					printf("\t请输入机械化步兵:");
					scanf("%f", &dhcp[2]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;


					for (i = 0; i < listnum && ifsearch != 1; i++)
					{

						if (fabs(dhcp[2] - stu[i].score[2]) < 1e-6)
						{
							//ifsearch = 1;
							printf("\n编号    称号      坦克   武装直升机 机械化步兵 总体战力 组织度\n\n");
							printf("%-8s%-10s", stu[i].num, stu[i].name);
							for (j = 0; j < M; j++)
								printf("%-9.2f", stu[i].score[j]);
							printf("%-9.2f", stu[i].total);
							printf("%-9.2f\n", stu[i].avr);
							ifsearch = 1;
							printf("\n\n\t确定删除该部队信息?(y/n)");
							while (1)
							{
								c = getch();
								if (c == 'y' || c == 'Y') { flag = 1; /*ifsearch = 0;*/ }
								if (c == 'n' || c == 'N') flag = 0;
								if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
							}
							if (flag == 1)
							{

								for (j = 0; j < listnum - 1; j++)
									stu[j] = stu[j + 1];
								member++;
								printf("\n\n\t\t删除成功");
							}
						}
					}
				}
			}
			if (ifsearch == 0)
			{
				printf("\n\n\t抱歉您输入的部队信息有误");
			}
			//else { printf("\n\n\t抱歉您要修改的学生不存在"); }
		}
		//else { printf("抱歉您要删除的学生不存在"); }
		//if ("ifsearch==0") printf("抱歉您查找的学生不存在");
		printf("\n\n\n\t是否继续?(Y/N)");
		while (1)
		{
			c = getch();
			if (c == 'y' || c == 'Y') { flag = 1; ifsearch = 0; }
			if (c == 'n' || c == 'N') flag = 0;
			if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
		}
	}
	listnum = listnum - member;
	fp = fopen("date", "wb");
	for (i = 0; i < listnum; i++)
		fwrite(&stu[i], sizeof(struct student), 1, fp);
	fclose(fp);
}
void ratio()
{
	int i, j, flag = 1, ifsearch = 0, afsearch = 0;
	char  name[8], c, d;
	float cnn, scc;
	float dhcp[K];
	struct all
	{
		char num[8];
		char name[8];
		float score[M];
		float total;
		float avr;
	}a1 = { "cs1","橙色军团",90000,90000,90000,270000,90000 };
	system("color a4");
	system("cls");
	printf("\n\n\n\n\t==========欢迎来到战争管理比对系统========\n\n");
	while (flag == 1)
	{
		printf("\n\t请选择比对方式\n");
		printf("\n\t总体战力比对请输入a,各兵种比对请输入b\n");
		getchar();
		scanf("%c", &d);
		if (d == 'a' || d == 'A')
		{
			printf("\n\t请选择查询条件,输入a可以按照编号/称号查询,输入b可以按照总体战力/组织度查询,c可以按照战备数量查询\n");
			getchar();
			scanf("%c", &d);
			if (d == 'a' || d == 'A')
			{
				printf("\n\t请您输入要查找的部队编号/称号后敲回车");
				scanf("%s", &name);
				for (i = 0; i < listnum; i++)
				{
					if (strcmp(name, stu[i].name) == 0)
					{
						ifsearch = 1;
						if (a1.total - stu[i].total > 0)
						{
							scc = a1.total - stu[i].total;
							printf("指挥官,抱歉,你输了,敌人部队总战力还剩 %f", scc);
						}
						if (a1.total - stu[i].total < 0)
						{
							scc = stu[i].total - a1.total;
							printf("恭喜你指挥官,你成功战胜了敌人!你的总战力还剩 %f", scc);
						}
						if (a1.total == stu[i].total)
							printf("指挥官你们打了个平手");
						/*ifsearch = 1;*/
					}
					else if (strcmp(name, stu[i].num) == 0)
					{
						ifsearch = 1;
						if (a1.total - stu[i].total > 0)
						{
							scc = a1.total - stu[i].total;
							printf("指挥官,抱歉,你输了,敌人部队总战力还剩 %f", scc);
						}
						if (a1.total - stu[i].total < 0)
						{
							scc = stu[i].total - a1.total;
							printf("恭喜你指挥官,你成功战胜了敌人!你的总战力还剩 %f", scc);
						}
						if (a1.total == stu[i].total)
							printf("指挥官你们打了个平手");
					}

				}
				if (ifsearch == 0)
				{
					printf("\n\n\t抱歉您输入的部队编号/称号有误");
				}
			}
			//else { printf("\n\n\t抱歉您查找的学生不存在"); }
			if (d == 'b' || d == 'B')
			{
				printf("\n\t请您输入要查找的部队总体战力/组织度查询后敲回车");
				scanf("%f", &cnn);
				for (i = 0; i < listnum; i++)
				{
					if (fabs(cnn - stu[i].total) < 1e-6)
					{
						ifsearch = 1;
						if (a1.total - stu[i].total > 0)
						{
							scc = a1.total - stu[i].total;
							printf("指挥官,抱歉,你输了,敌人部队总战力还剩 %f", scc);
						}
						if (a1.total - stu[i].total < 0)
						{
							scc = stu[i].total - a1.total;
							printf("恭喜你指挥官,你成功战胜了敌人!你的总战力还剩 %f", scc);
						}
						if (a1.total == stu[i].total)
							printf("指挥官你们打了个平手");
					}
					else if (fabs(cnn - stu[i].avr) < 1e-6)
					{
						ifsearch = 1;
						if (a1.total - stu[i].total > 0)
						{
							scc = a1.total - stu[i].total;
							printf("指挥官,抱歉,你输了,敌人部队总战力还剩 %f", scc);
						}
						if (a1.total - stu[i].total < 0)
						{
							scc = stu[i].total - a1.total;
							printf("恭喜你指挥官,你成功战胜了敌人!你的总战力还剩 %f", scc);
						}
						if (a1.total == stu[i].total)
							printf("指挥官你们打了个平手");
					}
					//else { printf("\n\n\t抱歉您查找的学生不存在"); }
				}
				if (ifsearch == 0)
				{
					printf("\n\n\t抱歉您输入的部队总体战力/组织度有误");
				}
			}
			//else { printf("\n\n\t抱歉您查找的学生不存在"); }
			if (d == 'c' || d == 'C')
			{
				printf("\n\t请您输入要查找的部队战备数量查询后敲回车(查询坦克请输入d,查询武装直升机请输入e,查询机械化步兵请输入f)\n");
				getchar();
				scanf("%c", &d);
				if (d == 'd' || d == 'D')
				{
					for (i = 0; i < listnum && ifsearch != 1; i++)
					{



						printf("\t请输入坦克数量:");
						scanf("%f", &dhcp[0]);
						//stu[i].total = stu[i].total + stu[i].score[j];
						//afsearch = 1;


						for (i = 0; i < listnum && ifsearch != 1; i++)
						{
							if (fabs(dhcp[0] - stu[i].score[0]) < 1e-6)
							{
								ifsearch = 1;
								if (a1.total - stu[i].total > 0)
								{
									scc = a1.total - stu[i].total;
									printf("指挥官,抱歉,你输了,敌人部队总战力还剩 %f", scc);
								}
								if (a1.total - stu[i].total < 0)
								{
									scc = stu[i].total - a1.total;
									printf("恭喜你指挥官,你成功战胜了敌人!你的总战力还剩 %f", scc);
								}
								if (a1.total == stu[i].total)
									printf("指挥官你们打了个平手");
							}


						}
						/*if (afsearch == 1)
						{
							break;
							printf("\n\n\t抱歉您输入的学生成绩有误");
						}
					   */
					   //else { printf("\n\n\t抱歉您要查询的学生不存在"); }
					}
				}
				if (d == 'e' || d == 'E')
				{
					for (i = 0; i < listnum && ifsearch != 1; i++)
					{



						printf("\t请输入武装直升机数量:");
						scanf("%f", &dhcp[1]);
						//stu[i].total = stu[i].total + stu[i].score[j];
						//afsearch = 1;


						for (i = 0; i < listnum && ifsearch != 1; i++)
						{
							if (fabs(dhcp[1] - stu[i].score[1]) < 1e-6)
							{
								ifsearch = 1;
								if (a1.total - stu[i].total > 0)
								{
									scc = a1.total - stu[i].total;
									printf("指挥官,抱歉,你输了,敌人部队总战力还剩 %f", scc);
								}
								if (a1.total - stu[i].total < 0)
								{
									scc = stu[i].total - a1.total;
									printf("恭喜你指挥官,你成功战胜了敌人!你的总战力还剩 %f", scc);
								}
								if (a1.total == stu[i].total)
									printf("指挥官你们打了个平手");
							}


						}

					}
				}
				if (d == 'f' || d == 'F')
				{
					for (i = 0; i < listnum && ifsearch != 1; i++)
					{



						printf("\t请输入机械化步兵数量:");
						scanf("%f", &dhcp[2]);
						//stu[i].total = stu[i].total + stu[i].score[j];
						//afsearch = 1;


						for (i = 0; i < listnum && ifsearch != 1; i++)
						{
							if (fabs(dhcp[2] - stu[i].score[2]) < 1e-6)
							{
								ifsearch = 1;
								if (a1.total - stu[i].total > 0)
								{
									scc = a1.total - stu[i].total;
									printf("指挥官,抱歉,你输了,敌人部队总战力还剩 %f", scc);
								}
								if (a1.total - stu[i].total < 0)
								{
									scc = stu[i].total - a1.total;
									printf("恭喜你指挥官,你成功战胜了敌人!你的总战力还剩 %f", scc);
								}
								if (a1.total == stu[i].total)
									printf("指挥官你们打了个平手");
							}


						}

					}
				}
				if (ifsearch == 0)
				{
					printf("\t\t抱歉您查找的部队不存在");
				}
			}
			//else { printf("抱歉您查找的学生不存在"); }
		}
		else if (d == 'b' || d == 'B')

		{
			printf("\n\t请您输入要查找的部队战备数量查询后敲回车(查询坦克请输入d,查询武装直升机请输入e,查询机械化步兵请输入f)\n");
			getchar();
			scanf("%c", &d);
			if (d == 'd' || d == 'D')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{



					printf("\t请输入坦克数量:");
					scanf("%f", &dhcp[0]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;


					for (i = 0; i < listnum && ifsearch != 1; i++)
					{
						if (fabs(dhcp[0] - stu[i].score[0]) < 1e-6)
						{
							ifsearch = 1;
							if (a1.score[0] - stu[i].score[0] > 0)
							{
								scc = a1.score[0] - stu[i].score[0];
								printf("指挥官,抱歉,你输了,敌人部队的坦克还剩 %f", scc);
							}
							if (a1.total - stu[i].total < 0)
							{
								scc = stu[i].score[0] - a1.score[0];
								printf("恭喜你指挥官,你成功战胜了敌人!你的坦克还剩 %f", scc);
							}
							if (a1.score[0] == stu[i].score[0])
								printf("指挥官你们打了个平手");
							/*ifsearch = 1;*/
						}


					}
					/*if (afsearch == 1)
					{
						break;
						printf("\n\n\t抱歉您输入的学生成绩有误");
					}
				   */
				   //else { printf("\n\n\t抱歉您要查询的学生不存在"); }
				}
			}
			if (d == 'e' || d == 'E')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{



					printf("\t请输入武装直升机数量:");
					scanf("%f", &dhcp[1]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;


					for (i = 0; i < listnum && ifsearch != 1; i++)
					{
						if (fabs(dhcp[1] - stu[i].score[1]) < 1e-6)
						{
							ifsearch = 1;
							if (a1.score[1] - stu[i].score[1] > 0)
							{
								scc = a1.score[1] - stu[i].score[1];
								printf("指挥官,抱歉,你输了,敌人部队的武装直升机还剩 %f", scc);
							}
							if (a1.total - stu[i].total < 0)
							{
								scc = stu[i].score[1] - a1.score[1];
								printf("恭喜你指挥官,你成功战胜了敌人!你的武装直升机还剩 %f", scc);
							}
							if (a1.score[1] == stu[i].score[1])
								printf("指挥官你们打了个平手");
							/*ifsearch = 1;*/
						}


					}

				}
			}
			if (d == 'f' || d == 'F')
			{
				for (i = 0; i < listnum && ifsearch != 1; i++)
				{



					printf("\t请输入机械化步兵数量:");
					scanf("%f", &dhcp[2]);
					//stu[i].total = stu[i].total + stu[i].score[j];
					//afsearch = 1;


					for (i = 0; i < listnum && ifsearch != 1; i++)
					{
						if (fabs(dhcp[2] - stu[i].score[2]) < 1e-6)
						{
							ifsearch = 1;
							if (a1.score[2] - stu[i].score[2] > 0)
							{
								scc = a1.score[2] - stu[i].score[2];
								printf("指挥官,抱歉,你输了,敌人部队的机械化步兵还剩 %f", scc);
							}
							if (a1.total - stu[i].total < 0)
							{
								scc = stu[i].score[2] - a1.score[2];
								printf("恭喜你指挥官,你成功战胜了敌人!你的机械化步兵还剩 %f", scc);
							}
							if (a1.score[2] == stu[i].score[2])
								printf("指挥官你们打了个平手");
							/*ifsearch = 1;*/
						}


					}

				}
			}
			if (ifsearch == 0)
			{
				printf("\t\t抱歉您查找的部队不存在");
			}
		}
		//if ("ifsearch==0") printf("抱歉您查找的学生不存在");
		printf("\n\n\n\t是否继续?(Y/N)");
		while (1)
		{
			c = getch();
			if (c == 'y' || c == 'Y') { flag = 1; ifsearch = 0; }
			if (c == 'n' || c == 'N') flag = 0;
			if (c == 'y' || c == 'Y' || c == 'n' || c == 'N')break;
		}
	}

}
void main()// build by owen
{
	char item;
	int i = 0;
	char kkayward[8], kayward[8];
	system("color 3e");
	printf("\n\n\t\t   = =     帝国     = = =");
	printf("\n\n\t\t   = =指挥官您好,欢迎来到战争信息管理系统= = =");
	printf("\n\n\t\t 首先,请您先请设置您的个人密码\n");
	scanf("%s", &kayward);
	system("cls");
	printf("\n\n\t\t 您已经成功设置好密码,请继续\n");
	system("cls");
	printf("\n\n\t\t   = = = = = = = = = = = = = = = = = ");
	printf("\n\n\t\t   = =欢迎使用战争信息管理系统= = =");
	printf("\n\n\t\t   = = = = = = = = = = = = = = = = = ");
	printf("\n\n\t\t   请输入您的个人密码\n");
	getchar();
	//scanf("%d",&kkayward);
	for (i = 0; i < 3; i++)
	{
		scanf("%s", &kkayward);
		if (strcmp(kayward, kkayward) == 0)
		{
			printf("\n\n\t\t   密码正确\n");
			system("cls");
			listcount();
			do
			{
				menu();
				while (1)
				{
					item = getch();
					if ((item >= '1' && item <= '7') || item == Esc)break;
					else printf("\t输错了");
				}
				switch (item)
				{
				case '1':input(); break;
				case '2':output(); break;
				case '3':sort(); break;
				case '4':search(); break;
				case '5':change(); break;
				case '6':del(); break;
				case '7':ratio(); break;
				}
			} while (item != Esc);
			exit1();
		}

		else {
			printf("\n\n\t\t   错了,请重试\n");
		}
	}
	if (3 == i)
	{
		printf("\n\n\t\t   程序失败退出程序.\n");
	}
	system("pause");
}

功能展示在这里插入图片描述在这里插入图片描述

在这里插入图片描述 在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值