user-0 提问: 求帮忙改个c程序 拜托了

回复:
user: user-1
content: #include<time.h> #include<stdio.h>  #include<conio.h>  #include <stdlib.h>   #define MAX 50  void prudctInfo(); void sort(); void prudctgoto(); void prudctinsert(); void prudctdelete(); void prudctupdate(); void average();  int now_no = 0; struct student { 	int no; 	char name[20]; 	int zong; 	float jin; 	float chu; 	int chuliang; 	float sort; 	int kucun; 	float xiaoshousum; 	float jingliave; }; struct student stu[MAX], *p; int main(void) { 	char as = 0;  start:  	printf("\t\t\t\t超市商品管理系统\n\n");  	do { 		printf("\n\t\t\t\t1.商品详细\n\t\t\t\t2.商品买卖\n\t\t\t\t3.库存商品登陆\n\t\t\t\t4.库存商品删除\n\t\t\t\t5.库存商品修改\n\t\t\t\t6.退出\n"); 		printf("\t\t\t\t选择功能选项: "); 		as = getchar(); 		switch (as) 		{ 		case '1': 			system("cls"); 			prudctInfo(); 			break; 		case '2': 			system("cls"); 			prudctgoto(); 			break; 			break; 		case '3': 			system("cls"); 			prudctinsert(); 			break; 		case '4': 			system("cls"); 			prudctdelete(); 			break; 		case '5': 			system("cls"); 			prudctupdate(); 			break; 		case '6': 			system("exit"); 			exit(0); 		default: 			system("cls"); 			goto start; 		} 	} while (1); } void prudctInfo() { 	int i; 	char as; 	float ave; 	do 	{ 		printf("\t\t商品详细\n"); 		printf("\t编号\t商品名\t库存\t单价\t销售数\t销售额\t净利润\n"); 		for (i = 0; i<now_no; i++) 		{ 			stu[i].kucun = stu[i].zong - stu[i].chuliang; 			stu[i].xiaoshousum = stu[i].chu*stu[i].chuliang; 			stu[i].jingliave = stu[i].chu*(stu[i].chu - stu[i].jin); 			printf("\t%d \t%s \t%d \t%.2f\t%d\t%.2f\t%.2f\n", 				stu[i].no, stu[i].name, stu[i].kucun, stu[i].chu, stu[i].chuliang, stu[i].xiaoshousum, stu[i].jingliave); 		} 		printf("\t\t按任意键返回主菜单."); 		as = getch(); 		goto exit; 	} while (as != 'n'); exit: system("cls"); } void prudctgoto() { 	int i = 0; 	char ch; 	int numberID = 0; 	int geshu = 0; 	int a = 0; 	do 	{ 		printf("\t\t商品一览\n"); 		printf("\t编号\t商品名\t库存\t单价\n"); 		for (i = 0; i<now_no; i++) 		{ 			stu[i].kucun = stu[i].zong - stu[i].chuliang; 			printf("\t%d \t%s \t%d \t%.2f\n", 				stu[i].no, stu[i].name, stu[i].kucun, stu[i].chu); 		} 		a = -1; 		printf("\n商品编号:"); 		scanf("%d", &numberID); 		for (i = 0; i<now_no; i++) 		{ 			if (stu[i].no == numberID){ 				a = i; 			} 		} 		if (a == -1){ 			printf("没这个商品!"); 			ch = getch(); 			system("cls"); 		} 		else{ 			printf("\n卖出个数:"); 			scanf("%d", &geshu); 			if (stu[a].zong<geshu){ 				printf("没这么多商品"); 				ch = getch(); 				system("cls"); 			} 			else{ 				fflush(stdin); 				stu[a].chuliang = geshu; 			} 		} 		printf("是否继续输入?(Y/N)"); 		ch = getch(); 		system("cls"); 	} while (ch != 'n'); 	system("cls"); } void prudctinsert() { 	int i = 0; 	char ch; 	do 	{ 		printf("\t\t\t\t1.输入商品信息\n输入第%d个商品情报\n", i + 1); 		printf("\n登陆商品编号:"); 		scanf("%d", &stu[i].no); 		fflush(stdin); 		printf("\n登陆商品名:"); 		fflush(stdin); 		gets(stu[i].name); 		printf("\n登陆超市进货商品个数:"); 		fflush(stdin); 		scanf("%d", &stu[i].zong); 		printf("\n登陆商品进货单价:"); 		fflush(stdin); 		scanf("%f", &stu[i].jin); 		printf("\n登陆商品售出单价:"); 		fflush(stdin); 		scanf("%f", &stu[i].chu); 		stu[i].chuliang = 0; 		printf("\n\n"); 		i++; 		now_no = i; 		printf("%d", now_no); 		printf("是否继续输入?(Y/N)"); 		ch = getch(); 		system("cls"); 	} while (ch != 'n'); 	system("cls"); } void prudctdelete(){ 	int inum, i, j; 	printf("输入要删除商品编号:"); 	fflush(stdin); 	scanf("%d", &inum); 	for (i = 0; i<now_no; i++) 	{ 		if (stu[i].no == inum) 		{ 			for (j = i; j<now_no; j++) 			{ 				stu[i] = stu[i + 1]; 			} 			now_no = now_no - 1; 		} 		break; 	} 	system("cls"); } void prudctupdate(){ 	char ch; 	do 	{ 		printf("\n\t\t输入新商品信息\n"); 		printf("\n登陆商品编号:"); 		scanf("%d", &stu[now_no].no); 		fflush(stdin); printf("\n登陆商品名:"); 		fflush(stdin); 		gets(stu[now_no].name); 		printf("\n登陆超市进货商品个数:"); 		fflush(stdin); 		scanf("%d", &stu[now_no].zong); 		printf("\n登陆商品进货单价:"); 		fflush(stdin); 		scanf("%f", &stu[now_no].jin); 		printf("\n登陆商品售出单价:"); 		fflush(stdin); 		scanf("%f", &stu[now_no].chu); 		printf("\n登陆超市商品卖去个数:"); 		fflush(stdin); 		scanf("%d", &stu[now_no].chuliang); 		printf("\n\n"); 		now_no = now_no + 1; 		printf("是否继续输入?(Y/N)"); 		ch = getch(); 		system("cls"); 	} while (ch != 'n'); } void sort() { 	struct student temp; 	int i, j; 	for (i = 1; i<now_no; i++) 	{ 		for (j = 1; j <= now_no - i; j++) 		{ 			if (stu[j - 1].jingliave<stu[j].jingliave) 			{ 				temp = stu[j]; 				stu[j] = stu[j - 1]; 				stu[j - 1] = temp; 			} 		} 	} }