内容发布更新时间 : 2024/12/23 9:21:53星期一 下面是文章的全部内容请认真阅读。
while(feof(fp)==0) { if(fread(&temp,sizeof(product),1,fp)!=0) { if(strcmp(temp.name,name)==0) result=1; } }
if(result==0) { printf(\要删除的商品%s不存在\\n\ fclose(fp); goto begin; }
fclose(fp);
fp=fopen(datafile,\if(fp==NULL) {
printf(\文件%s打不开\\n\ exit(1);} recnumber=0;
while((fread(&tmps,sizeof(product),1,fp))!=0) { if(strcmp(tmps.name,name)!=0) { s[recnumber].number=tmps.number; strcpy(s[recnumber].name,tmps.name); s[recnumber].price=tmps.price; s[recnumber].discount=tmps.discount;
s[recnumber].memberprice=tmps.memberprice; recnumber++; } }
fclose(fp);
fp=fopen(datafile,\if(fp==NULL) {
printf(\文件%s打不开\\n\ exit(1); }
for(i=0;i printf(\文件%s打不开\\n\ exit(1); } } fclose(fp); printf(\删除成功!\\n\ printf(\是否继续删除(y/n)\\n\ next=getche(); if(next=='y'||next=='Y') goto begin; printf(\删除商品信息如下:\\n\ fp=fopen(datafile,\ if(fp==NULL) { printf(\文件%s打不开\\n\ exit(1); } printf(\序号\\t名称\\t价格\\t折扣\\t会员价\\n\ while(fread(&show,sizeof(product),1,fp)!=0) printf(\w.memberprice); fclose(fp); } 4.2、删除商品信息界面