C語言-寵物商店管理系統(tǒng)-實訓(xùn)報告_第1頁
C語言-寵物商店管理系統(tǒng)-實訓(xùn)報告_第2頁
C語言-寵物商店管理系統(tǒng)-實訓(xùn)報告_第3頁
C語言-寵物商店管理系統(tǒng)-實訓(xùn)報告_第4頁
C語言-寵物商店管理系統(tǒng)-實訓(xùn)報告_第5頁
已閱讀5頁,還剩9頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

實訓(xùn)報告實訓(xùn)項目:寵物商店管理系統(tǒng)院別專業(yè):信息管理學(xué)院班級學(xué)號:學(xué)生姓名:煜指導(dǎo)教師:實訓(xùn)成績:實驗日期:2018年6月8日制信息管理學(xué)院制實踐教學(xué)中心實訓(xùn)目的:1掌握C語法,函數(shù),界面程序設(shè)計,文件操作。2掌握C文件編程方法。實訓(xùn)內(nèi)容及要求:用C語言設(shè)計基于文件的寵物商店管理系統(tǒng)。要求具有信息顯示、錄入、修改、查詢和刪除的界面并完成相關(guān)功能。三、實訓(xùn)方案:系統(tǒng)功能結(jié)構(gòu)、主要界面與主要代碼:1.功能結(jié)構(gòu)如下:以下圖僅供參考,以實際所做的系統(tǒng)功能為準(zhǔn)?。。。?!2.主要功能介紹:}/*添加寵物類型*/voidtjcwlx(){inttypeId; chartypeName[20]; typeId=getcurrenttypeindex(); if(typeId==-1) { printf("當(dāng)前寵物類型的數(shù)量已達(dá)上限,無法再次添加!\n"); return; } printf("請輸入新增寵物類型:"); scanf("%s",typeName); pettypes[typeId-1].typeId=typeId; strcpy(pettypes[typeId-1].name,typeName);pettypes[typeId-1].petstore=0;printf("新寵物類型%s,已經(jīng)添加成功!\n",typeName);};/*修改寵物類型*/voidxgcwlx(){ inttypeId;chartypeName[20]; printf("請輸入需要修改寵物類型編號:");scanf("%d",&typeId); if(istypeexistsbyId(typeId)==-1) { printf("當(dāng)前系統(tǒng)不存在您輸入的寵物類型編號!\n"); return; } else { printf("名稱:%s\n",pettypes[typeId-1].name); } printf("請輸入修改后的寵物名稱:"); scanf("%s",typeName); strcpy(pettypes[typeId-1].name,typeName); printf("編號是%d的寵物類型名稱已經(jīng)改成%s!\n",typeId,typeName);};/*顯示全部的寵物類型*/voidtjqbdcwlx(){ inti; printf("類型編號\t類型名稱\n"); for(i=0;i<SIZE;i++) { if(pettypes[i].typeId==0) { break; } printf("%3d\t\t%s\n",pettypes[i].typeId,pettypes[i].name); }};/*添加寵物進(jìn)貨記錄*/voidtjcwxsjl(){ inttransId; inttypeId; intpurchasenum; time_ttp; structtm*p; time(&tp); p=localtime(&tp); transId=getcurrenttransinfoindex(); if(transId==-1) { printf("寵物交易記錄次數(shù)已經(jīng)達(dá)到上限,無法再次進(jìn)貨!"); return; } printf("請輸入本次進(jìn)貨的寵物類型編號:"); scanf("%d",&typeId); if(istypeexistsbyId(typeId)==-1) { printf("當(dāng)前系統(tǒng)不存在您輸入的寵物類型編號!\n"); return; } printf("請輸入本次寵物進(jìn)貨的數(shù)量:"); scanf("%d",&purchasenum); if(purchasenum<1) { printf("進(jìn)貨數(shù)量不能小于1,操作失?。n"); return; } time(&tp); p=gmtime(&tp); pettransinfos[transId-1].year=p->tm_year+1900; pettransinfos[transId-1].month=p->tm_mon+1; pettransinfos[transId-1].day=p->tm_mday;//strftime(pettransinfos[transId-1].data,sizeof(pettransinfos[transId-1].data),"%Y-%m-%d",localtime(&tp)); pettransinfos[transId-1].transId=transId; pettransinfos[transId-1].typeId=typeId; pettransinfos[transId-1].num=purchasenum; pettransinfos[transId-1].transtype=0; updatepetstore(typeId,purchasenum,1); printf("本次寵物進(jìn)貨完成記錄!");};/*添加寵物銷售記錄*/voidxscwqbjyjl(){ inttransId; inttypeId; intpurchasenum; time_ttp; structtm*p; time(&tp); p=localtime(&tp); transId=getcurrenttransinfoindex(); if(transId==-1) { printf("寵物交易記錄次數(shù)已經(jīng)達(dá)到上限,無法再次銷售!"); return; } printf("請輸入本次銷售的寵物類型編號:"); scanf("%d",&typeId); if(istypeexistsbyId(typeId)==-1) { printf("當(dāng)前系統(tǒng)不存在您輸入的寵物類型編號!\n"); return; } printf("請輸入本次銷售的寵物數(shù)量:"); scanf("%d",&purchasenum); if(purchasenum>pettypes[typeId-1].petstore) { printf("當(dāng)前該類型寵物的庫存數(shù)量不足,無法進(jìn)行銷售!\n"); return; } time(&tp); p=gmtime(&tp); pettransinfos[transId-1].year=p->tm_year+1900; pettransinfos[transId-1].month=p->tm_mon+1; pettransinfos[transId-1].day=p->tm_mday; //strftime(pettransinfos[transId-1].data,sizeof(pettransinfos[transId-1].data),"%Y-%m-%d",localtime(&tp)); pettransinfos[transId-1].transId=transId; pettransinfos[transId-1].typeId=typeId; pettransinfos[transId-1].num=purchasenum; pettransinfos[transId-1].transtype=1; updatepetstore(typeId,purchasenum,2); printf("本次寵物銷售完成記錄!");};/*顯示寵物全部交易記錄*/voidxscwjytjxx(){ inti; char*name; printf("寵物編號\t寵物名稱\t交易數(shù)量\t交易日期\t交易類型\n"); for(i=0;i<SIZET;i++) { if(pettransinfos[i].transId==0) { break; } if(pettransinfos[i].transtype==0) { name="入庫"; } elseif(pettransinfos[i].transtype==1) { name="售出"; } else { name="未知"; } printf("%3d\t\t%s\t\t%3d\t\t%d-%d-%d\t%s\n",pettransinfos[i].typeId,pettypes[pettransinfos[i].typeId-1].name,pettransinfos[i].num,pettransinfos[i].year,pettransinfos[i].month,pettransinfos[i].day,name); }};/*顯示寵物交易統(tǒng)計信息*/voidxszgncd(){ constchar*split="-"; inti; char*name; intmonth; intj; intpurchasenum=0; intsalenum=0; printf("請輸入需要查看的月份:"); scanf("%d",&month); printf("類型編號\t類型名稱\t入庫數(shù)量\t銷售數(shù)量\t庫存數(shù)\n"); for(i=0;i<SIZE;i++) { if(pettypes[i].typeId==0) { break; } for(j=0;j<SIZET;j++) { if(pettransinfos[j].transId==0) { break; } if(pettransinfos[j].month==month&&pettransinfos[j].typeId==pettypes[i].typeId) { if(pettransinfos[j].transtype==0) { purchasenum+=pettransinfos[j].num; } else { salenum+=pettransinfos[j].num; } } } printf("%3d\t\t%s\t\t%3d\t\t%3d\t\t%3d\n",pettypes[i].typeId,pettypes[i].name,purchasenum,salenum,purchasenum-salenum); }};intgetcurrenttypeindex(){ intindex=-1; inti; for(i=0;i<SIZE;i++) {if(pettypes[i].typeId==0) { index=i+1; break; } } returnindex;}intgetcurrenttransinfoindex(){ intindex=-1; inti; for(i=0;i<SIZET;i++) { if(pettransinfos[i].transId==0) { index=i+1; break; } } returnindex;}intistypeexistsbyId(inttypeId){ if(typeId<1||typeId>SIZE||pettypes[typeId-1].typeId==0) { return-1; } else { return1; }}intupdatepetstore(inttypeId,intnum,intrecordtype){ intcount; count=pettypes[typeId-1].petstore; if(recordtype==1) { count+=num; } else { count-=num; } if(count>=0) { pettypes[typeId-1].pets

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論