user-0 提问: C语言新手求助，程序中修改函数和删除函数用不了（用不同颜色标出部分），请帮忙看看..

回复:
user: user-1
content: 代码功能归根结底不是别人帮自己看或讲解或注释出来的；而是被自己静下心来花足够长的时间和精力亲自动手单步或设断点或对执行到某步获得的中间结果显示或写到日志文件中一步一步分析出来的。 提醒：再牛×的老师也无法代替学生自己领悟和上厕所！ 单步调试和设断点调试（VS IDE中编译连接通过以后，按F10或F11键单步执行，按Shift+F11退出当前函数；在某行按F9设断点后按F5执行停在该断点处。）是程序员必须掌握的技能之一。

user: user-0
content: 求助啊 ~~~~

user: user-0
content: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <windows.h> struct stu { 	char name[30]; 	char tel[30]; 	char email[30]; 	char job[30]; }stu[200]; int mm=0; int s1=0; int s2=0; int s3=0; int s4=0; int s5=0; int bz=0; int f=0; int k; int i=0; void read() { 	FILE *fp; 	if((fp=fopen("D:\\通讯录.txt","r"))==NULL) 	{  		printf("file cannot open!\n"); 	} 	int i=0; 	while(!feof(fp)) 	{ 	fread(&stu[i],sizeof(struct stu),1,fp); 	i++; 	} 	for(k=0;k<i-1;k++) 	{ 		printf("姓名:%s\t电话:%s\t邮箱:%s\t职务:%s\n",stu[k].name,stu[k].tel,stu[k].email,stu[k].job); 	} 	fclose(fp); } void add() { 	FILE* fp=fopen("D:\\通讯录.txt","a+"); 	int n; 	struct stu stu[200]; 	printf("新建联系人个数："); 	scanf("%d",&n); 	int i; 	for(i=0;i<n;i++) 	{ 		printf("\t姓名："); 		scanf("%s",stu[i].name); 		printf("\t电话："); 		scanf("%s",&stu[i].tel); 		printf("\t邮箱："); 		scanf("%s",&stu[i].email); 		printf("\t职务："); 		scanf("%s",&stu[i].job); 		fwrite(&stu[i],sizeof(struct stu),1,fp); 		mm++; 	} 	fclose(fp);  } void sorting()                                        //排序 { 	FILE *fp; 	fp=fopen("D:\\通讯录.txt","r+"); 	struct stu* p=(struct stu*)malloc(sizeof(struct stu)); 	struct stu temp; 	int st; 	for(st=1;st<200;st++) 	{ 		fread(&stu[st],sizeof(struct stu),1,fp); 		if(strcmp((p+st)->name,(p+st-1)->name)==1) 		{ 			temp=*(p+st); 			*(p+st)=*(p+st-1); 			*(p+st-1)=temp; 		} 		 	} } void listtop() { 	FILE *fp; 	if((fp=fopen("D:\\通讯录.txt","r"))==NULL) 	{  		printf("file cannot open!\n"); 	} 	int i=0; 	while(!feof(fp)) 	{ 	fread(&stu[i],sizeof(struct stu),1,fp); 	i++; 	} 	for(k=0;k<i-1;k++) 	{ 		printf("姓名:%s\t电话:%s\n",stu[k].name,stu[k].tel); 	} 	fclose(fp); } void list() { 	printf("    |                  |   \n"); 	printf("    |  1.查询联系人    |   \n"); 	printf("    |  2.编辑联系人    |   \n"); 	printf("    |  3.显示全部信息  |   \n"); 	printf("    |  4.退出通讯录    |   \n"); } void listcx() { 	printf("    |     查询联系人     |   \n"); 	printf("    |                    |   \n"); 	printf("    |   1.按姓名查找     |   \n"); 	printf("    |   2.按电话查找     |   \n"); 	printf("    |   3.按邮箱查找     |   \n"); 	printf("    |   4.按职务查找     |   \n"); 	printf("    |   5.返回上一级菜单 |   \n"); } void listbj() { 	printf("    |     编辑联系人     |   \n"); 	printf("    |                    |   \n"); 	printf("    |   1.添加联系人     |   \n"); 	printf("    |   2.修改联系人     |   \n"); 	printf("    |   3.删除联系人     |   \n"); 	printf("    |   4.返回上一级菜单 |   \n"); 	printf("    |                    |   \n"); } int main() { 	struct stu stu[200]; K:	printf("                       通        讯        录                     \n"); 	printf("=======================================================================\n"); 	listtop(); 	printf("=======================================================================\n"); G:	list(); 	int xz1; 	scanf("%d",&xz1); 	switch(xz1) 	{ 	case 1:                                        //查询 L:		system("cls"); 		listcx(); 		int xz2; 		scanf("%d",&xz2); 		switch(xz2) 		{ 		case 1: 			FILE *fp; 			fp=fopen("D:\\通讯录.txt","r"); 			int a,xz4; 			s1=0; 			char aname[20]; 			printf("姓名:"); 			scanf("%s",&aname); 			for(a=0;a<200;a++) 			{ 				fread(&stu[a],sizeof(struct stu),1,fp); 				if(strcmp(aname,stu[a].name)==0) 				{ 					s1++; 					system("cls"); 					printf("姓名:%s    电话:%s    邮箱:%s    职务:%s\n",stu[a].name,stu[a].tel,stu[a].email,stu[a].job); 				} 			} 			if(s1==0) 			{ 				system("cls"); 				printf("查无此人\n"); 			} 			break; 		case 2: 			FILE *fp1; 			fp=fopen("D:\\通讯录.txt","r+"); 			int a1,xz5; 			s2=0; 			char atel[20]; 			fflush(stdin); 			printf("电话:"); 			scanf("%s",&atel); 			for(a1=0;a1<200;a1++) 			{ 				fread(&stu[a1],sizeof(struct stu),1,fp); 				if(strcmp(atel,stu[a1].tel)==0) 				{ 					s2++; 					system("cls"); 					printf("姓名:%s    电话:%s    邮箱:%s    职务:%s\n",stu[a1].name,stu[a1].tel,stu[a1].email,stu[a1].job); 				} 			} 			if(s2==0) 			{ 				system("cls"); 				printf("查无此人\n"); 			} 			break; 		case 3: 			FILE *fp2; 			fp=fopen("D:\\通讯录.txt","r+"); 			int a2,xz6; 			s3=0; 			char aemail[20]; 			fflush(stdin); 			printf("邮箱:"); 			scanf("%s",&aemail); 			for(a2=0;a2<200;a2++) 			{ 				fread(&stu[a2],sizeof(struct stu),1,fp); 				if(strcmp(aemail,stu[a2].email)==0) 				{ 					s3++; 					system("cls"); 					printf("姓名:%s    电话:%s    邮箱:%s    职务:%s\n",stu[a2].name,stu[a2].tel,stu[a2].email,stu[a2].job); 				} 			} 			if(s3==0) 			{ 				system("cls"); 				printf("查无此人\n"); 			} 			break; 		case 4: 			FILE *fp3; 			fp=fopen("D:\\通讯录.txt","r+"); 			int a3,xz7; 			s4=0; 			char ajob[20]; 			fflush(stdin); 			printf("职务:"); 			scanf("%s",&ajob); 			for(a3=0;a3<200;a3++) 			{ 				fread(&stu[a3],sizeof(struct stu),1,fp); 				if(strcmp(ajob,stu[a3].job)==0) 				{ 					s4++; 					system("cls"); 					printf("姓名:%s    电话:%s    邮箱:%s    职务:%s\n",stu[a3].name,stu[a3].tel,stu[a3].email,stu[a3].job); 				} 			} 			if(s4==0) 			{ 				system("cls"); 				printf("查无此人\n"); 			} 			break; 		case 5: 			system("cls"); 			goto K; 		default: 			goto L; 		} Z:		int xz8; 		printf("==================================================================\n"); 		printf("   1.返回    \n"); 		scanf("%d",&xz8); 		if(xz8==1) 		{ 			system("cls"); 			goto K; 		} 		else 		{ 			system("cls"); 			goto Z; 		} 	case 2:                                        //编辑 M:		system("cls"); 		listbj(); 		int xz3; 		int v; 		scanf("%d",&xz3); 		switch(xz3) 		{ 		case 1:                                    //添加 			add(); 			system("cls"); 			goto K; 		case 2:                                    //修改 			system("cls"); 			FILE *fp; 			fp=fopen("D:\\通讯录.txt","rb+"); 			char xtel[30]; 			char xemail[30]; 			char xjob[30]; 			char cname[30]; 			char xname[30]; 			int cc; 			printf("姓名:"); 			scanf("%s",&cname); 			for(cc=0;cc<200;cc++) 			{ 				fread(&stu[cc],sizeof(struct stu),1,fp); 				if(strcmp(cname,stu[cc].name)==0) 				{ 					printf("修改姓名为:"); 					scanf("%s",&xname); 					strcpy(stu[cc].name,xname); 					printf("修改电话为:"); 					scanf("%s",&xtel); 					strcpy(stu[cc].tel,xtel); 					printf("修改邮箱为:"); 					scanf("%s",&xemail); 					strcpy(stu[cc].email,xemail); 					printf("修改职务为:"); 					scanf("%s",&xjob); 					strcpy(stu[cc].job,xjob); 					system("cls"); 					printf("修改后:\n"); 					printf("姓名:%s\t电话:%s\t邮箱:%s\t职务:%s\n",stu[cc].name,stu[cc].tel,stu[cc].email,stu[cc].job); 					fwrite(&stu[cc],sizeof(struct stu),1,fp); 					bz++; 				} 			} 			fclose(fp); 			if(bz==0) 			{ 				system("cls"); 				printf("无此联系人\n"); 			} 			break; 		case 3:                                    //删除 			system("cls"); 			FILE *fp1; 			fp1=fopen("D:\\通讯录.txt","rb+"); 			int aa; 			char bname[30]; 			int c; 			int fc; 			printf("姓名:"); 			scanf("%s",&bname); 			for(c=0;c<200;c++) 			{ 				fread(&stu[c],sizeof(struct stu),1,fp1); 				if(strcmp(stu[c].name,bname)==0) 				{ 					for(aa=c;aa<200;aa++) 					{ 						strcpy(stu[aa].name,stu[aa+1].name); 						strcpy(stu[aa].tel,stu[aa+1].tel); 						strcpy(stu[aa].email,stu[aa+1].email); 						strcpy(stu[aa].job,stu[aa+1].job); 						fwrite(&stu[aa],sizeof(struct stu),1,fp); 					} 					s5++; 				} 			} 			if(s5==0) 				printf("无此联系人\n"); 			else 				printf("删除成功\n"); 			break; 		case 4: 			system("cls"); 			goto K; 			break; 		default: 			goto M; 		} 		int xz9; 		printf("===============================================================\n"); O:		printf("1.返回   \n"); 		scanf("%d",&xz9); 		if(xz9==1) 		{ 			system("cls"); 			goto M; 		} 		else 		{ 			system("cls"); 			goto O; 		} 	case 3: 		system("cls"); 		printf("                       通        讯        录                     \n"); 		printf("=======================================================================\n"); 		read(); 		printf("=======================================================================\n"); 		goto G; 	case 4:                                         //退出 		exit(0); 	default: 		system("cls"); 		goto K; 	} 	return 0; }

user: user-2
content: 代码先从新上传一下吧  ase 3: system("cls"); printf("                       通        讯        录                     \n"); printf("=======================================================================\n"); read(); printf("=======================================================================\n"); goto G; case 4:                                         //退出

user: user-0
content: = =没有人来看么？