『壹』 跪求高手用c語言寫一個簡單的倉庫管理系統
1,簡單起見,可採用控制台程序實現;
2,程序大概可劃分為:輸入模塊、排序模塊、輸出模塊等;
3,輸入模塊:設計一種數據結構,用來存儲圖書名字;
可以是指針數組,可以是鏈表、。。。
4,排序模塊:選擇一種排序演算法,比如冒泡,快速排序等,上網查一下。
5,輸出模塊列印最終的排序結果;
如果上述你都能實現,可以再擴展,索引查詢模塊等等。。。
大一才開始起步,自己的要多寫代碼。。。
再煩也別忘微笑,再急也要注意語調!
『貳』 編寫C語言倉庫管理系統
有答案的也發下我郵箱[email protected] 謝謝啦
『叄』 如何用C語言編一個小型的倉庫管理系統,作為課程設計的 謝了哈
可以完成源代碼的編制
『肆』 c語言程序設計家電倉庫管理系統 求大神幫助
#include <stdafx.h>
#include<stdio.h>
#include<string.h>
#define SIZE 2//SIZE為倉庫電器種類
struct goods
{
char name[10];
char brand[10];
char style[10];
int num;
float money;
}stu[SIZE];//庫存結構
struct date
{
int year;
int month;
int day;
};//日期結構
struct entrance
{
char name[10];
char brand[10];
char style[10];
int num;
float money;
struct date time;
char stuf[10];
}stu_2[SIZE];//入庫結構
struct exit
{
char name[10];
char brand[10];
char style[10];
int num;
struct date time;
char stuf[10];
}stu_3[SIZE];//出庫結構
void main()
{
void save_1();
void save_2();
void save_3();
void change_1();
void change_2();
void found_1();
void found_2();
int i;
printf("please input the information:\n");
for(i=0;i<SIZE;i++)
{
scanf("%s%s%s%d%d",stu[i].name,stu[i].brand,stu[i].style,&stu[i].num,&stu[i].money);
} //輸入庫存
save_1(); //利用函數將庫存保存
FILE *fp;
fp=fopen("stu_list.txt","rb");
for(i=0;i<SIZE;i++)
{
fread(&stu[i],sizeof(struct goods),1,fp);
printf("%s %s %s %d %d",stu[i].name,stu[i].brand,stu[i].style,stu[i].num,stu[i].money);
printf("\n");
} //讀出信息
fclose(fp);
printf("請輸入物資入庫信息:\n");//輸入入庫信息
for(i=0;i<SIZE;i++)
scanf("%s%s%s%d%f%d%d%d%s",stu_2[i].name,stu_2[i].brand,stu_2[i].style,&stu_2[i].num,&stu_2[i].money,&stu_2[i].time.year,&stu_2[i].time.month,&stu_2[i].time.day,stu_2[i].stuf);
save_2(); //創建入庫文件
change_1();
printf("請輸入出庫信息\n");
scanf("%s%s%s%d%d%d%d%s",stu_3[i].name,stu_3[i].brand,stu_3[i].style,&stu_3[i].num,&stu_3[i].time.year,&stu_3[i].time.month,&stu_3[i].time.day,stu_3[i].stuf);
for(i=0;i<SIZE;i++)
{
if(stu_3[i].num>stu[i].num)
{
printf("the error number!please input again!\n");
break;
}
else
{
save_3();
change_2();
}
}
found_1();
found_2();
}
void save_1()
{
FILE *fp;
int i;
if((fp=fopen("stu_list.txt","wb"))==NULL)
{
printf("connot open the file\n");
return;
}
for(i=0;i<SIZE;i++)
{
if(fwrite(&stu[i],sizeof(struct goods),1,fp)!=1)
printf("file write error\n");
}
fclose(fp);
}
void save_2()
{
FILE *fp;
int i;
if((fp=fopen("stu_list_2.txt","wb"))==NULL)
{
printf("connot open the file\n");
return;
}
for(i=0;i<SIZE;i++)
{
if(fwrite(&stu_2[i],sizeof(struct entrance),1,fp)!=1)
printf("file write error\n");
}
fclose(fp);
}
void change_1()
{
int i;
for(i=0;i<SIZE;i++)
{
if(strcmp(stu[i].name,stu_2[i].name)==0&&strcmp(stu[i].brand,stu_2[i].brand)==0&&strcmp(stu[i].style,stu_2[i].style)==0)
{
stu[i].num=stu[i].num+stu_2[i].num;
}
}
save_1();
}
void save_3()
{
FILE *fp;
int i;
if((fp=fopen("stu_list_3.txt","wb"))==NULL)
{
printf("connot open the file\n");
return;
}
for(i=0;i<SIZE;i++)
{
if(fwrite(&stu_3[i],sizeof(struct exit),1,fp)!=1)
printf("file write error\n");
}
fclose(fp);
}
void change_2()
{
int i;
for(i=0;i<SIZE;i++)
{
if(strcmp(stu[i].name,stu_3[i].name)==0&&strcmp(stu[i].brand,stu_3[i].brand)==0&&strcmp(stu[i].style,stu_3[i].style)==0)
{
stu[i].num=stu[i].num-stu_3[i].num;
}
}
save_1();
}
void found_1()
{
FILE *fp;
int i;
int sum=0;
char name[10];
char brand[10];
printf("please input the name and brand:\n");//4.1 4.2 5.1
scanf("%s%s",name,brand);
if((fp=fopen("stu.list.txt","rb"))==NULL)
{
printf("connot open the file!\n");
return;
}
for(i=0;i<SIZE;i++)
{
if(fread(&stu[i],sizeof(struct goods),1,fp)!=1)
{
if(strcmp(name[10],stu[i].name[10])==0)
{
printf("the information of the good:\n");
printf("%s %s %s %d %d",stu[i].name,stu[i].brand,stu[i].style,stu[i].num,stu[i].money);
sum=sum+stu[i].num;
}
if(strcmp(brand[10],stu[i].brand[10])==0)
{
printf("the information of the good:\n");
printf("%s %s %s %d %d",stu[i].name,stu[i].brand,stu[i].style,stu[i].num,stu[i].money);
}
}
}
printf("the number of this %s is %d.\n",name[10],sum);
}
void found_2()
{
FILE *fp;
int i;
int j;
int sum=0;
int year_1,year_2,month_1,month_2,day_1;
char name_1[10],name_2[10],style_1[10];
if((fp=fopen("stu_list_2.txt","rb"))==NULL)
{
printf("connot open the file!\n");
return;
}
if((fp=fopen("stu_list_3.txt","rb"))==NULL)
{
printf("connot open the file!\n");
return;
}
printf("please input year_1,month_1,day_1,then find the exit and entrance:\n");
scanf("%d%d%d",&year_1,&month_1,&day_1);
printf("please input the name and style,then find the good's entrance and exit");
scanf("%s%s",name_1,style_1);
printf("please input the name of the good,then output the number or its entrance:\n");
scanf("%s",name_2);
printf("please input year_2 and month_2,then output the number of exit in this month:\n");
scanf("%d%d",&year_2,&month_2);
printf("please input the red number,then output all the informations of the goods:\n");
scanf("%d",&j);
for(i=0;i<SIZE;i++)
{
if((fread(&stu_2[i],sizeof(struct entrance),1,fp)!=1)&&(fread(&stu_3[i],sizeof(struct exit),1,fp)!=1))//讀出入庫和出庫信息
{
if((stu_2[i].time.year==year_1)&&(stu_2[i].time.month==month_1)&&(stu_2[i].time.day==day_1))//入庫信息4.3
{
printf("%s%s%s%d%f%d%d%d%s",stu_2[i].name,stu_2[i].brand,stu_2[i].style,stu_2[i].num,stu_2[i].money,stu_2[i].time.year,stu_2[i].time.month,stu_2[i].time.day,stu_2[i].stuf);
}
if((stu_3[i].time.year==year_1)&&(stu_3[i].time.month==month_1)&&(stu_3[i].time.day==day_1))//出庫信息4.3
{
printf("%s%s%s%d%d%d%d%s",stu_3[i].name,stu_3[i].brand,stu_3[i].style,stu_3[i].num,stu_3[i].time.year,stu_3[i].time.month,stu_3[i].time.day,stu_3[i].stuf);
}
}
}
for(i=0;i<SIZE;i++)//4.4
{
if((fread(&stu_2[i],sizeof(struct entrance),1,fp)!=1)&&(fread(&stu_3[i],sizeof(struct exit),1,fp)!=1))//讀出入庫和出庫信息
{
if((strcmp(stu_2[i].name,name_1))==0&&(strcmp(stu_2[i].style,style_1))==0)
{
printf("%s%s%s%d%f%d%d%d%s",stu_2[i].name,stu_2[i].brand,stu_2[i].style,stu_2[i].num,stu_2[i].money,stu_2[i].time.year,stu_2[i].time.month,stu_2[i].time.day,stu_2[i].stuf);
}
if((strcmp(stu_3[i].name,name_1))==0&&(strcmp(stu_3[i].style,style_1))==0)
{
printf("%s%s%s%d%d%d%d%s",stu_3[i].name,stu_3[i].brand,stu_3[i].style,stu_3[i].num,stu_3[i].time.year,stu_3[i].time.month,stu_3[i].time.day,stu_3[i].stuf);
}
}
}
for(i=0;i<SIZE;i++)//5.3
{
if((fread(&stu_3[i],sizeof(struct exit),1,fp)!=1))
if(stu_3[i].time.year==year_2&&stu_3[i].time.month==month_2)
{
sum=sum+stu_3[i].num;
}
}
printf("the time of exit is %d.\n",sum);
for(i=0;i<SIZE;i++)
{
if((fread(&stu[i],sizeof(struct goods),1,fp)!=1))
{
if(stu[i].num<j)
{
printf("th information of the good are:\n");
printf("%s%s%s%d%f",stu[i].name,stu[i].brand,stu[i].style,stu[i].num,stu[i].money);
}
}
}
}
『伍』 C語言寫一個倉庫管理系統
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<malloc.h>#define max 32int ifempty=0;//標志,判斷鏈表是無否為空typedef struct dnode /* 定義雙向鏈表結構體 */ {int number; /* 貨物編號 */char name[max]; /* 貨物名稱 */ int counter; /* 貨物數量 */struct dnode *prior, *next;/* 定義兩指針,分別指向其前驅和後繼 */}dlnode; dlnode *create(dlnode *L);dlnode *input(dlnode *L);dlnode *output(dlnode *L);dlnode * outnum(dlnode *L);dlnode * outname(dlnode *L);dlnode *current(dlnode *L);void search(dlnode *L);void print(dlnode *L);void searchnum(dlnode *L);void searchname(dlnode *L);void display(dlnode *L) ;void main(){int x;dlnode *L;if(!(L=(dlnode *)malloc(sizeof(dlnode)))) //分配空間{printf("\n");exit(1);}create(L);///調用函數,創建頭節點while(1){////////////////////////主菜單///////////////////////////printf(" ============================\n");printf(" 1. 貨物出庫和入庫\n");printf(" 2. 查找貨物表\n"); printf(" 3. 顯示倉庫貨物表\n");printf(" 4. 輸出到文件\n");printf(" 0. 退出\n");printf(" =============================\n");printf(" 選擇0--3:");scanf("%d",&x);switch(x){case 2:search(L);break;//調用查找函數case 1:current(L);break;//調用入庫出庫函數case 3:display(L);break;//調用顯示輸出函數case 4:print(L);break;//調用列印函數case 0:printf("\n bye!see you!\n");getchar();getchar();exit(0);//退出程序default:printf("\n Enter erreor!please input 0--4!"); getchar();getchar();}}}dlnode *create(dlnode *L)//創建鏈表頭節點{printf(" 歡迎使用我的倉庫管理系統");getchar(); ifempty=0;///////初始化頭節點的值////////L->next=NULL;L->prior=NULL;L->number=L->counter=0;strcpy(L->name," "); return L;}void search(dlnode *L) ///查找的主要菜單{int y;if(ifempty==0){printf("沒有輸入貨物!\n");getchar();getchar();return;}else{while(1){printf("=====================\n");printf("1.按編號查詢\n");printf("2.按貨物名稱查詢\n");printf("0.返回上一層\n");printf("====================\n");printf("選擇0--2:");scanf("%d",&y);switch(y){case 1:searchnum(L);break;//調用按編號查找的函數case 2:searchname(L);break;//調用按名稱查找的函數case 0:return;//返回default:printf("enter error!Please input 0--2!\n\n");getchar();getchar();printf("\n\n");}}}}void searchnum(dlnode *L)///按編號查找的函數{int num,flag=0;//flag為是否找到的標志dlnode *head=L;if(ifempty==0){printf("沒有貨物被輸入\n");getchar();getchar();return;}printf("輸入你要查找的貨物編號:\n");scanf("%d",&num);while((L=L->next)!=head){if(L->number==num){ flag=1;//flag為1時表示找到printf("找到指定編號貨物 \n"); printf("\n編號:%d\n",L->number);printf("名稱:%s\n",L->name) ;printf("數量:%d\n\n",L->counter); } }if(flag==0)//flag為0時表示沒有找到printf("沒有找到指定編號貨物,請查看是否還有貨物。\n");getchar();getchar();}void searchname(dlnode *L)//按名稱查找的函數{int flag=0;//flag為是否找到的標志char na[32];dlnode *head=L;if(ifempty==0){printf("沒有貨物被輸入\n");getchar();getchar();return;}printf("輸入你要查找的貨物名稱\n");scanf("%s",&na);while((L=L->next)!=head){if(strcmp(L->name,na)==0){ flag=1;//flag為1時表示找到printf("找到指定名稱貨物 \n"); printf("\n編號:%d\n",L->number);printf("名稱:%s\n",L->name) ;printf("數量:%d\n\n",L->counter); } }if(flag==0)//flag為0時表示沒有找到printf("沒有找到指定編號貨物,請查看是否還有貨物。\n\n");getchar();getchar();}dlnode *current(dlnode *L)//貨物出庫入庫函數{int y;while(1){printf("========================\n");printf(" 1.貨物入庫\n");printf(" 2.貨物出庫\n");printf(" 0.返回上一層\n");printf("========================\n");printf(" 選擇0--2:");scanf("%d",&y);switch(y){case 1:input(L);break;//調用入庫函數case 2:output(L);break;//調用出庫函數case 0:return(L);//返回上一層default:printf("enter error!Please input 0--2!");getchar();getchar();printf("\n\n");}}}dlnode *input(dlnode *L)//定義入庫函數{dlnode *in,*head;head=in=(dlnode *)malloc(sizeof(dlnode));//分配空間head=L;printf("\n請輸入貨物數據:\n");printf("編號:");scanf("%d",&in->number);printf("名稱:");scanf("%s",&in->name);printf("數量:");scanf("%d",&in->counter);if(L->next==NULL) //如果只有頭節點,{ //把剛輸入的in節點L->next=in; //跟在頭節點後面L->prior=in; //in->next=L; //in->prior=L; //ifempty++; //ifempty加1}else{//如果當前L的下一個節點不是頭節點while((L=L->next)!=head){//如果輸入的數大於L->number,則插到L的前面if(L->number<in->number){in->next=L;in->prior=L->prior; L->prior->next=in;L->prior=in;ifempty++; //ifempty加1return(head);} }//輸入的編號比其它編號都小,則插到最後個節點,並首尾相連head->prior->next=in;in->prior=head->prior;head->prior=in;in->next=head;ifempty++; //ifempty加1} return head;}dlnode *output(dlnode *L)//出庫的函數{int y;dlnode *head=L;if(ifempty==0)//檢測是否有貨物輸入{printf("沒有貨物輸入系統\n");getchar();getchar();return(head);} while(1){printf("=============\n");printf("1.按編號出庫\n");printf("2.按名稱出庫\n");printf("0.返回上一層\n");printf("==============\n");printf("選擇0--2:");scanf("%d",&y);switch(y){case 1:outnum(L);break;//調用按編號出庫函數case 2:outname(L);break;//調用按名稱出庫函數case 0:return(L);default:printf("enter error!Please input 0--2!");getchar();getchar();printf("\n\n");}}} dlnode *outnum(dlnode *L)//按編號出庫函數{ int num;dlnode *head=L;printf("請輸入出庫貨物的編號:");scanf("%d",&num);while((L=L->next)!=head){//如果找到就刪除節點if(L->number==num){L->prior->next=L->next;L->next->prior=L->prior;ifempty--; //ifempty減1 printf("編號為%d的貨物成功出庫",num); getchar();getchar();return head; } }printf("沒有此編號的貨物,請查看是否還有貨物。\n\n");getchar();getchar();return (head);}dlnode *outname(dlnode *L)//按名稱出庫函數{char na[32];dlnode *head=L;printf("請輸入出庫貨物的名稱:");scanf("%s",&na);while((L=L->next)!=head){//如果找到就刪除節點if(strcmp(L->name,na)==0){L->prior->next=L->next;L->next->prior=L->prior;ifempty--; //ifempty減1 printf("名稱為%s的貨物成功出庫",na);getchar();getchar();return (head);}}printf("沒有此名稱的貨物,請查看是否還有貨物。\n\n");getchar();getchar();return(head);} void display(dlnode *L)//顯示貨物清單{dlnode *head=L;if(ifempty==0){printf("沒有貨物可顯示\n");getchar();getchar();return;}L=L->next;do{ printf("\n編號:%d\n",L->number);printf("名稱:%s\n",L->name) ;printf("數量:%d\n\n",L->counter);}while((L=L->next)!=head);getchar();getchar(); }void print(dlnode *L){dlnode *head=L;L=L->next;char filename[max];FILE *out;if(ifempty==0){printf("沒有貨物可輸出\n");getchar();getchar();return;}printf("請輸入文件名稱:");scanf("%s",filename);if((out=fopen(filename,"w"))==NULL){printf("打開文件失敗!\n");getchar();getchar();return;}do{ fprintf(out,"編號:%d\n名稱:%s\n數量:%d\n\n",L->number,L->name,L->counter);}while((L=L->next)!=head);printf("輸出成功\n");getchar();getchar();fclose(out);}
『陸』 用C語言寫一個倉庫管理系統實現增加、修改、刪除、添加等功能
用結構體數組就可以實現增刪改查的功能
『柒』 C語言倉庫管理系統
倉庫管理系統C語言C++數據結構鏈表課程設計
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <conio.h>
#define MAX 64
typedef struct node{ /* 定義結構體類型dnode */ int number; /* 貨物編號 */ char name[MAX]; /* 貨物名稱 */ int counter; /* 貨物數量 */ struct node *prior,*next; /* 前驅和後繼指針 */}dnode;
dnode* head = NULL;
void output_one(dnode* n) /* 輸出一條記錄 */{ printf("%d\t%s\t%d\n", n->number, n->name, n->counter);}
void output() /* 輸出所有記錄 */{ dnode* pos = head; if(head == NULL) { return; } while (pos) { output_one(pos); /* 循環調用output_one */ pos = pos->next; }}
int insert() /* 插入一條數據 */{ dnode* pos = head; dnode* n = malloc(sizeof(dnode)); n->prior = NULL; n->next = NULL; printf("請輸入貨物編號:"); scanf("%d", &n->number); printf("請輸入貨物名稱:"); scanf("%s", n->name); printf("請輸入貨物數量:"); scanf("%d", &n->counter); if(head==NULL) /* 如果還沒有頭節點,就作為頭節點 */ { head = n; return 1; } while (pos) { if(pos->number > n->number) /* 按順序查找,如果找到比自己大的,就插在它前面 */ { if(pos->prior) pos->prior->next = n; n->prior = pos->prior; pos->prior = n; if(pos->next) pos->next->prior = n; n->next = pos; return 1; } else if(pos->number == n->number) { free(n); return 0; /* 有重復數據,插入不成功 */ } if (!pos->next) /* 如果已經到鏈表尾部,插入到後面 */ { pos->next = n; n->prior = pos; return 1; } pos = pos->next;
} return 1;}
void init(){ while (1) /* 初始化,循環插入 */ { insert(); printf("按任意鍵繼續輸入,按Esc停止輸入\n"); if(getch()==27) break; }}
int delete() /* 刪除一條記錄 */{ int num; dnode* pos = head; printf("請輸入要刪除的編號:"); scanf("%d", &num);
if(head == NULL) { return 0; } while (pos) { if(pos->number == num) /* 找到匹配的項 */ { if(pos->prior) pos->prior->next = pos->next; if(pos->next) pos->next->prior = pos->prior; free(pos); return 1; } pos = pos->next; } return 0; // 沒找到}
int amend() /* 修改數量 */{ int num, count; dnode* pos = head; printf("請輸入要修改的編號:"); scanf("%d", &num); printf("請輸入要修改的數量:"); scanf("%d", &count); if(head == NULL) { return 0; } while (pos) { if(pos->number == num) { if (count == 0) /* 如果數量是0,就刪除 */ { if(pos->prior) pos->prior->next = pos->next; if(pos->next) pos->next->prior = pos->prior; free(pos); return 1; } pos->counter = count; return 1; } pos = pos->next; } return 0; }
void search() /* 按編號查找 */{ int num; dnode* pos = head;
printf("請輸入要查找的編號:"); scanf("%d", &num);
if(head == NULL) { return; } while (pos) { if(pos->number == num) { output_one(pos); /* 找到就列印 */ return; } pos = pos->next; }}
void search_by_name() /* 按名稱查找 */{ char name[MAX]; dnode* pos = head; printf("請輸入要查找的名稱:"); scanf("%s", name);
if(head == NULL) { return; } while (pos) { if(!strcmp(pos->name, name)) output_one(pos); pos = pos->next; }}
int main(){ init(); while (1) { char ch; system("cls"); printf("\t\t\t\ti 增加新貨物\n"); printf("\t\t\t\td 刪除某種貨物\n"); printf("\t\t\t\ta 修改某種貨物的數量\n"); printf("\t\t\t\ts 查找指定的貨物\n"); printf("\t\t\t\to 輸出存貨信息\n"); printf("\t\t\t\tq 退出程序\n"); ch = getch(); switch (ch) { case 'i': case 'I': insert(); break;
case 'd': case 'D': delete(); break;
case 'a': case 'A': amend(); break;
case 's': case 'S': printf("1. 按編號查找\n2. 按名稱查找\n"); ch = getch(); if(ch == '1') { search(); } else if(ch == '2') { search_by_name(); } break;
case 'o': case 'O': output(); break;
case 'q': case 'Q': return 0; break; } printf("按任意鍵繼續...\n"); getch(); } return 0;}
『捌』 怎麼用C語言設計一個小型倉庫管理系統
你是要接別人的活兒,還是在做課程設計,如果不是必須用c語言的話,還是建議你用VC加資料庫,這樣更簡單 。如果必須只用c語言來做,那你就得定義一系列的結構體,然後把數據存儲在文件里。
如何在使用文件函數讀寫。
你的圖有點模糊,只能大體說一下思路。
『玖』 求高手幫我用c語言編個簡單的商品網站的倉庫管理系統 運行環境要sql2005和visual studio 2008的
已發郵箱,滿意請給分!~~~
『拾』 C語言設計倉庫管理系統
c語言倉庫管理幫實現