【问题标题】:Adds the product to the list of products in the file IF the SKU is unique如果 SKU 是唯一的,则将产品添加到文件中的产品列表中
【发布时间】: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


猜你喜欢
  • 2013-01-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-01
  • 2018-05-10
  • 1970-01-01
相关资源
最近更新 更多