【发布时间】:2022-06-15 19:13:44
【问题描述】:
如果 SKU 是唯一的,则将产品添加到文件中的产品列表中。 它还会更新文件顶部的产品数量。
If the product is added succesfully, RETURNS 1, otherwise RETURNS 0
#include <stdio.h>
int main(){
double price;
printf("enter the price please\n");
scanf("%lf",&price);
FILE *file=fopen("products.txt","a");
char *id[40];
double salary;
int count;
fscanf(file, "%d", &count);
while(fscanf(file,"%s %lf",id,&salary)!=EOF){
printf("%s %lf\n",id,salary);
}
fclose(file);
return 0;
}
【问题讨论】:
-
你有什么问题?
标签: c