xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

資源簡介

c語言課程作業編寫商品信息管理系統 要求將商品信息寫入文件中并具有查詢增加更改功能

資源截圖

代碼片段和文件信息

#include
#include
struct?commdity??//定義商品結構體?
{
???char?name[10];
???int?num;
???float?price;
???int?amount;
???float?total;
}comm[100]tempt[100];
void?save(int?m)????//定義一個存儲函數,將商品信息存入文件中?
{
FILE?*fp;int?i;
if((fp=fopen(“C:\commdity.txt““w“))==NULL)
{
printf(“cannot?open?file\n“);
}
fprintf(fp“商品名稱??商品代碼??商品單價?????商品數量????商品金額\n“);
for(i=0;i fprintf(fp“%-10s%-10d%-16f%-9d%-20f\n“comm[i].namecomm[i].numcomm[i].pricecomm[i].amountcomm[i].total);
fclose(fp);
}

int?main()
{

int?nij;
char?ch=‘n‘;
printf(“你想輸入幾條商品記錄?\n“);
scanf(“%d“&n);
while(ch==‘n‘||ch==‘N‘)
{
???????printf(“請輸入商品名稱,代碼,單價,數量:\n“);
???for(i=0;i ???{
printf(“NO%d?“i+1);
scanf(“%s%d%f%d“&comm[i].name&comm[i].num&comm[i].

評論

共有 條評論