當前位置:律師網大全 - 商標註冊 - # include & ltstdio.h & gt# include & ltstdlib.h & gt# include & ltstring.h & gt# include & ltconio.h & gt結構ima { int id茶

# include & ltstdio.h & gt# include & ltstdlib.h & gt# include & ltstring.h & gt# include & ltconio.h & gt結構ima { int id茶

# include & ltstdio.h & gt

# include & ltstdlib.h & gt

# include & ltstring.h & gt

# include & ltconio.h & gt

結構ima

{

int id

char name[20];

炭化產物〔30〕;

int數;

浮動價格;

};

void Append();

void sell delete();

void Amend();

void Findin();

void Browse()。

void colorsetting();

void end program();

void初始化()

{

FILE * fp

Struct ima i={1,"花生牛奶","湖北武漢",1200,2.5 };

Fp=fopen("ima.dat evil "," W ");

if(fp==NULL)

{

printf(" \ t \ t \ t系統錯誤,請重試...................................................................................................................................................

退出(0);

}

fwrite(& amp;I,sizeof(struct ima),1,FP);

fclose(FP);

}

無效菜單()

{

int選擇;

超市庫存管理系統

Printf (" -系統菜單顯示如下。

printf(" \ n \ t 1 = = = = = = = = = = = = = = = = = = = = = = =新購買的物品入庫\ n ");

printf(" \ n \ T2 = = = = = = = = = = = = = = = = = = =項目信息已刪除\ n ");

printf(" \ n \ T3 = = = = = = = = = = = = = = = = = = =項目信息修改\ n ");

printf(" \ n \ T4 = = = = = = = = = = = = = = = = = = =物品信息查詢\ n ");

printf(" \ n \ t5 = = = = = = = = = = = = = = = = = = = =瀏覽物品信息\ n ");

printf(" \ n \ T6 = = = = = = = = = = = = = = = = = = = = =應用程序退出\ n ");

printf(" \ n \ t請輸入您要選擇的菜單...");

scanf("%d ",& amp選擇);

開關(選擇)

{

案例1:

append();

打破;

案例二:

sell delete();

打破;

案例三:

amend();

打破;

案例4:

findin();

打破;

案例5:

browse();

打破;

案例6:

end program();

打破;

默認值:

printf(" \ n \ t \ t \ t \ t \ t輸入無效,請重新輸入...");

getch();

系統(“cls”);

menu();

}

}

int validateID(int id)

{

FILE * fp

結構IMA I;

fp=fopen("ima.date "," r ");

if(fp==NULL)

{

printf(" \ t \ t \ t系統錯誤,請重試...................................................................................................................................................

退出(0);

}

弗雷德(& ampI,sizeof(struct ima),1,FP);

而(!feof(fp))

{

if(i.id==id)

{

fclose(FP);

返回1;

打破;

}

弗雷德(& ampI,sizeof(struct ima),1,FP);

}

fclose(FP);

返回0;

}

void追加()

{ struct IMA I;

char選擇;

FILE * fp

fp=fopen("ima.date "," ab ");

if(fp==NULL)

{

printf(" \ t \ t \ t系統錯誤,請重試...................................................................................................................................................

退出(0);

}

labID:

printf(" \ n \ t請輸入要入庫的項目信息...\ n ");

printf(" \ t \ t \ t \ tItem number:");

scanf("%d ",& ampI . id);

if(validateID(i.id)==1)

{

printf(" \ t \ t \ t \ t該號碼已被使用,請重新輸入...");

goto labID

}

printf(" \ t \ t \ t \ t項目名稱:");

scanf("%s ",I . name);

Printf("\t\t\t\t物品生產地:");

scanf("%s ",I . produce);

printf(" \ t \ t \ t項目數量:");

scanf("%d ",& amp編號);

printf(" \ t \ t \ t \ t該項目的單位價格:");

scanf("%f ",& ampI .價格);

fwrite(& amp;I,sizeof(struct ima),1,FP);

fclose(FP);

printf(" \ t \ t \ t \ t \ t \ t項目信息已成功接收!!!\ n ");

printf(" \ n是否要繼續?(y/n)");

scanf(" %c ",& amp選擇);

if(choice=='Y'||choice=='y ')

{

append();

}

其他

{

系統(“cls”);

menu();

}

}

void Selldelete()

{ struct IMA I[1000];

結構ima溫度;

int delID

char選擇;

int index = 0;

int j = 0;

FILE * fp

fp=fopen("ima.date "," r ");

if(fp==NULL)

{

printf(" \ t \ t \ t系統錯誤,請重試............................................................................."));

退出(0);

}

弗雷德(& amptemp,sizeof(struct ima),1,FP);

而(!feof(fp))

{

I[index]= temp;

index++;

弗雷德(& amptemp,sizeof(struct ima),1,FP);

}

fclose(FP);

printf(" \ n \ t請輸入要刪除的項目的編號:");

scanf("%d ",& ampdelID);

fopen("f:\\ima.date "," w ");

if(fp==NULL)

{

printf(" \ t \ t \ t系統錯誤,請重試............................................................................."));

退出(0);

}

for(j = 0;j & lt指數;j++)

{

if(i[j]。id!=delID)

{

fwrite(& amp;i[j],sizeof(struct ima),1,FP);

}

}

fclose(FP);

printf(" \ t \ t \ t \ t \ t項目信息已被清除!!!\ n ");

printf(" \ n是否要繼續?(y/n)");

scanf(" %c ",& amp選擇);

if(choice=='Y'||choice=='y ')

{

sell delete();

}

其他

{

系統(“cls”);

menu();

}

}

void修正()

{ int index = 0;

int ID,j;

char選擇;

struct IMA I[1000];

結構ima溫度;

FILE * fp

fp=fopen("ima.date "," r ");

if(fp==NULL)

{

printf(" \ t \ t \ t系統錯誤,請重試...................................................................................................................................................

退出(0);

}

弗雷德(& amptemp,sizeof(struct ima),1,FP);

而(!feof(fp))

{

I[index]= temp;

index++;

弗雷德(& amptemp,sizeof(struct ima),1,FP);

}

fclose(FP);

fp=fopen("ima.date "," w ");

if(fp==NULL)

{

printf(" \ \ t \ t \ t系統錯誤,請再試壹次...........................................................................);

退出(0);

}

printf(" \ n \ t請輸入要修改的信息的項目編號:");

scanf("%d ",& ampID);

for(j = 0;j & lt= index-1;j++)

{

if(i[j]。id!=ID)

{

fwrite(& amp;i[j],sizeof(struct ima),1,FP);

}

其他

{

Printf ("\ t \ tItem名稱更改為:");

scanf("%s ",i[j].姓名);

printf(" \ t \ t物品生產地變更為");

scanf("%s ",i[j].產生);

printf(" \ t \ t項目數量更改為");

scanf("%d ",& amp我[j]。號);

printf(" \ t \ t商品單價改為");

scanf("%f ",& amp我[j]。價格);

fwrite(& amp;i[j],sizeof(struct ima),1,FP);

}

}

fclose(FP);

printf(" \ t \ t \ t \ t項目信息已被修改...");

printf(" \ n是否要繼續?(y/n)");

scanf(" %c ",& amp選擇);

if(choice=='Y'||choice=='y ')

{

amend();

}

其他

{

系統(“cls”);

menu();

}

}

void Findin()

{

FILE * fp

int findIDchar選擇;結構IMA I;

fp=fopen("ima.date "," r ");

if(fp==NULL)

{

printf(" \ t \ t \ t系統錯誤,請重試...................................................................................................................................................

退出(0);

}

finID:

printf(" \ n \ t請輸入要查詢的項目編號...");

scanf("%d ",& ampfindID);

弗雷德(& ampI,sizeof(struct ima),1,FP);

而(!feof(fp))

{

if(i.id==findID)

{

Printf ("\ n \ n \ t * * * * * * * * * * *項目信息* * * * * * * * * * * *);

printf(" \ n \ t項目編號...%30d\n ",I . id);

printf(" \ n \ t-");

printf(" \ n \ t項目名稱...%30s\n ",I . name);

printf(" \ n \ t-");

printf(" \ n \ t制造商...%30s\n ",I . produce);

printf(" \ n \ t-");

printf(" \ n \ t導入的數量...%30d\n ",識別號);

printf(" \ n \ t-");

printf(" \ n \ t批發價格...%30.3f\n ",I . price);

printf(" \ n \ t-");

printf(" \ n是否要繼續?(y/n)");

scanf(" %c ",& amp選擇);

if(choice=='Y'||choice=='y ')

{

findin();

}

其他

{

系統(“cls”);

menu();

}

}

弗雷德(& ampI,sizeof(struct ima),1,FP);

}

fclose(FP);

printf(" \ t \ t \ t \ t \ t輸入的號碼不存在,請重新輸入...");

goto finID

}

void瀏覽()

{ struct IMA I;

int index = 0;

char選擇;

FILE * fp

fp=fopen("ima.date "," r ");

if(fp==NULL)

{

printf(" \ t \ t \ t系統錯誤,請重試...................................................................................................................................................

退出(0);

}

弗雷德(& ampI,sizeof(struct ima),1,FP);

而(!feof(fp))

{

index++;

printf(" \ n \ n \ t * * * * * * * * * * * * *項目信息% d * * * * * * * * * * ",index);

printf(" \ n \ t項目編號...%30d\n ",I . id);

printf(" \ n \ t-");

printf(" \ n \ t項目名稱...%30s\n ",I . name);

printf(" \ n \ t-");

printf(" \ n \ t制造商...%30s\n ",I . produce);

printf(" \ n \ t-");

printf(" \ n \ t導入的數量...%30d\n ",識別號);

printf(" \ n \ t-");

printf(" \ n \ t批發價格...%30.3f\n ",I . price);

printf(" \ n \ t-");

getch();

弗雷德(& ampI,sizeof(struct ima),1,FP);

}

fclose(FP);

printf(" \ n是否要繼續?(y/n)");

scanf(" %c ",& amp選擇);

if(choice=='Y'||choice=='y ')

{

browse();

}

其他

{

系統(“cls”);

menu();

}

}

void Endprogram()

{ char choice

系統(“cls”);

printf(" \ n \ n \ n \ n \ n \ n \ t \ t您確定要退出系統嗎?\ n \ n \ n \ t \ t如果要退出,請按“y”鍵,其他鍵將返回主菜單... ");

scanf(" %c ",& amp選擇);

if(choice=='Y'||choice=='y ')

{

系統(“cls”);

printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ t \ t \ t感謝您的使用!!!");

printf(" \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n ");

}

其他

{

系統(“cls”);

menu();

}

}

void main()

{

printf(" \ n \ n ");

printf(" \ t \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ n ");

printf(" \ t \ 3 \ 3 \ n ");

printf(" \ t \ 3 \ 3 \ n ");

Printf("\t\3歡迎\ 3 \ n ");

printf(" \ t \ 3 \ 3 \ n ");

printf(" \ t \ 3 \ 3 \ n ");

Printf("\t\3超市庫存管理系統\ 3 \ n ");

Printf("\t\3按任意鍵繼續\ 3 \ n ");

printf(" \ t \ 3 \ 3 \ n ");

printf(" \ t \ 3 \ 3 \ n ");

printf(" \ t \ 3 \ 3 \ n ");

printf(" \ t \ 3 \ 3 \ n ");

printf(" \ t \ 3 \ 3 \ n ");

printf(" \ t \ 3 \ 3 \ n ");

printf(" \ t \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3 \ 3);

getch();

系統(“cls”);

menu();

初始化();

menu();

}

  • 上一篇:大泉源酒怎麽鑒定真假
  • 下一篇:韓風習習註冊過商標嗎?還有哪些分類可以註冊?
  • copyright 2024律師網大全