#include #include #include struct Info { }; c菜单选择函数*/ { 记录选择的菜单*/ system("cls"); 欢迎来到仓库货物管理系统 puts("\\***********************MENU***********************\\n"); 录入货物信息 显示货物信息 查找货物信息 修改货物信息 删除货物信息 退出系统 puts("\\**************************************************\\n"); puts("*********************************"); printf("* 请选择你要输入数 puts("*********************************"); while(1) { 出错了!请再次输入 } return n; } 货物信息输入函数*/ { if((fp=fopen("F:\\\est\\\\filemolde\\\\123.txt { 不能打开文件! *\\n"); } do { printf("\num:"); gets(info.num); printf("\name:"); gets(info.name); printf("\price:"); scanf("%d",&info.price); printf("\amount:"); scanf("%d",&info.amount); getchar(); fwrite(&info,sizeof(info),1,fp); printf("***************************\\n"); printf("* 还需要输入吗 printf("***************************\\n"); ch=getchar(); getchar(); }while(ch=='Y'||ch=='y'); fclose(fp); } void printf1() { printf("\\%-10s\%-10s\%-10s\%-10s\\n } void printf2(struct Info info) { } 货物信息显示函数*/ { if((fp=fopen("F:\\\est\\\\filemolde\\\\123.txt 不能打开文件! *"); 输入任何键继续 printf("* 总共有%d条记录在其中 } v货物信息查询函数*/ { struct Info info; 为 1 按编号查询 ,flag为 2 按姓名查询*/ 记录符合条件的记录的个数*/ char ch[10]; char f; if((fp=fopen("F:\\\est\\\\filemolde\\\\123.txt { printf("* \ 不能打开文件 } do { 查询通过(1:编号 2:姓名): *\\n"); 出错了!请再次输入[1:编号][2:姓名] *\\n"); if(flag==1) /*按编号进行查询*/ printf("* 请输入你要查询的编号: 符合条件的记录数*/ else /*按姓名进行查询*/ printf("* 请输入你要查询的姓名: printf("* 总共有%d记录在其中 printf("* 还需要查询吗 }while(f=='Y'||f=='y'); fclose(fp); } 货物信息修改函数*/ { if((fp1=fopen("F:\\\est\\\\filemolde\\\\123.txt printf("************************************\\n"); printf(" * 不能打开文件 if((fp2=fopen("F:\\\est\\\\filemolde\\\\456.txt printf("************************************\\n"); printf(" * 不能打开文件 请输入你要修改的货物编号: printf("* 请输入新的信息: printf("* 修改成功 rename("F:\\\est\\\\filemolde\\\\456.txt 不能找到这个记录 还修改其他吗 } v货物信息删除函数*/ { if((fp1=fopen("F:\\\est\\\\filemolde\\\\123.txt printf("* \ 不能打开文件 if((fp2=fopen("F:\\\est\\\\filemolde\\\\456.txt printf("* \ 不能打开文件 printf("* 请输入你需要删除货物的编号: *\\n"); printf("* 删除成功 rename("F:\\\est\\\\filemolde\\\\456.txt 不能找到这个记录 printf("* 还删除其他吗 } 主函数*/ { while(1) while(1) { } }