今天给各位分享商品管理系统c语言策划案的语言策c语言销知识,其中也会对c语言销售管理系统设计进行解释,划案如果能碰巧解决你现在面临的理系问题,别忘了去时匆科技官网哦,统设现在开始吧!商品售管
本文目录一览:
#include stdio.h
#include conio.h
#include bios.h
#include dos.h
#include malloc.h
#define NULL 0
#define LEN sizeof(struct mcd)
struct data /*声明一个日期的结构体类型*/
{
int year;
int month;
int day;
};
struct mcd /*声明有关商品信息的结构体类型*/
{
int code; /*编 号*/
char name[12]; /*品 名*/
long price; /*单 价*/
int num; /*数 量*/
char place[20]; /*产 地*/
struct data putdate; /*入库时间*/
struct data selldate; /*销售时间*/
struct mcd * next; /*运用指针处理链表*/
};
int n; /*记录链表有几条数据*/
struct mcd *head; /*声明链表头的指针*/
creat() /*输入商品信息的函数*/
{
struct mcd *p1,*p2;
n=0;
p1=p2=(struct mcd *)malloc(LEN); /*开辟一个新单元存放信息*/
head=p1;
loop: {
clrscr();
printf("商品录入系统\n");
printf("录入号:%d\n",n+1);
printf("编 码:");
scanf("%d",p1-code);
printf("品 名:");
scanf("%s",p1-name);
printf("单 价:");
scanf("%ld",p1-price);
printf("数 量:");
scanf("%d",p1-num);
printf("产 地:");
scanf("%s",p1-place);
printf("入库时间:");
scanf("%d-%d-%d",p1-putdate.year,p1-putdate.month,p1-putdate.day);
}
while(p1-num!=0)
{
n=n+1;
if(n==1)head=p1;
else p2-next=p1;
p2=p1;
p1=(struct mcd *)malloc(LEN);
goto loop;
}
p2-next=NULL;
main();
}
print() /*输出数据列表的函数*/
{
int m=0;
struct mcd *p;
clrscr();
printf("编 号||品 名||单 价||数 量|| 产 地 ||入 库 时 间\n");
p=head;
if(head!=NULL)
do
{
printf("%-10d%-14s%-12ld%-10d%-22s%-4d-%-2d-%-2d\n",p-code,p-name,p-price,p-num,p-place,p-putdate.year,p-putdate.month,p-putdate.day);
p=p-next;
m=m+1;
if(m%23==0){ gotoxy(10,25);printf("按任意键继续.");getch();}
}while(p!=NULL);
getch();
main();
}
sell()
{
int code,m=3,ch;
long sum=0;
struct mcd *p1;
struct date today;
getdate(today);
clrscr();
printf("商品销售系统\n");
printf("编 号||||品 名|||| 产 地 ||||单 价(元)||||出 售 时 间\n");
loop:
do{
gotoxy(23,25);
printf("按任意键继续,F2结帐,ESC键退出");
ch=bioskey(0);
}while(0);
switch(ch)
{
case 15360:{
if(sum==0)
{
gotoxy(1,m);printf("还没有购买商品!");
getch();
sell();
break;
}
else {
gotoxy(1,m);
printf("------------------------------------------------------------------------------");
gotoxy(47,m+1);
printf("总价: %-12ld元",sum);
getch();
main();
break;
}
}
case 283:{ main();break;}
default:
{
gotoxy(23,25);
printf("请输入商品编码,会显示商品信息");
gotoxy(1,m);
scanf("%d",code);
if(head==NULL)
{
printf("你还没有进货.");
getch();
main();
break;
}
p1=head;
while(code!=p1-codep1-next!=NULL)
{ p1=p1-next;}
if(code==p1-code)
{
gotoxy(13,m);
printf("%-16s%-24s%-16ld%4d-%2d-%2d",p1-name,p1-place,p1-price,today.da_year,today.da_mon,today.da_day);
m=m+1;
p1-num=p1-num-1;
sum=sum+p1-price;
}
}
goto loop;
}
}
go()
{
int ch;
clrscr();
printf("请问你要进行什么操作?\n1,插入;2,删除;3,什么也不做;\n");
loop:
do{
ch=bioskey(0);
}while(0);
switch(ch)
{
case 561:insert();break;
case 818:del();break;
case 1075:main();break;
case 283:break;
default:{ gotoxy(1,3);printf("请按数字键选择!");goto loop;}
}
getch();
main();
}
insert()
{
struct mcd *p0,*p1,*p2;
p0=p1=p2=(struct mcd*)malloc(LEN);
p1=head;
clrscr();
printf("请输入要插入的商品的信息:\n");
printf("编 码:");
scanf("%d",p0-code);
printf("品 名:");
scanf("%s",p0-name);
printf("单 价:");
scanf("%ld",p0-price);
printf("数 量:");
scanf("%d",p0-num);
printf("产 地:");
scanf("%s",p0-place);
printf("入库时间:");
scanf("%d-%d-%d",p0-putdate.year,p0-putdate.month,p0-putdate.day);
if(head==NULL)
{
head=p0;
p0-next=NULL;
}
else
{
while((p0-codep1-code)(p1-next!=NULL))
{
p2=p1;
p1=p1-next;
}
if(p0-code=p1-code)
{
if(head==p1)head=p0;
else p2-next=p0;
p0-next=p1;
}
else
{
p1-next=p0;p0-next=NULL;
}
}
n=n+1;
print();
}
del()
{
int code;
struct mcd *p1,*p2;
clrscr();
printf("请输入要删除商品的编号:");
scanf("%d",code);
if(head==NULL)
{
printf("你还没有进货.");
getch();
main();
}
p1=head;
while(code!=p1-codep1-next!=NULL)
{
p2=p1;
p1=p1-next;
}
if(code==p1-code)
{
if(code==head)head=p1-next;
else p2-next=p1-next;
n=n-1;
print();
}
else
{
printf("找不到这条商品信息.");
getch();
print();
}
}
main()
{
do{
clrscr();
printf(" . : : \n");
printf(" '. :'''''''': : : :'''':'''':\n");
printf(" '. : : :'''''' :'''''' : : :\n");
printf(" ................ : : :', :', ''''':''''': : :\n");
printf(" '. .' : : : ', : ', : :....:....:\n");
printf(" '. .' : : ,' ,' : : : :\n");
printf(" '.' : : ', : : : :\n");
printf(".........:........... :........: : ', : :....:....:\n");
printf(" ............... :''''''''''''''': '''':'''' : \n");
printf(" : , , : :'''''': :'''''': ,' : : \n");
printf(" : , , : : : : : :''''''''': : ,' : \n");
printf(" : , , : : : : : : : : ,' ....:.... \n");
printf(" :, :''''''': : : : : : : : :,' : \n");
printf(" : : : : : : : : :'''''''''' ,' : \n");
printf(" : : : : : : : : :.......... ,' : \n");
printf(" : :.......: : : : : : : : ' : \n");
printf(" : : : : : : : : ......:.....\n");
printf(" : ..: :......: :......: :.........: \n");
gotoxy(60,19);
printf("赵飞宇制造 V1.0");
gotoxy(10,21);
printf("1,销售系统;2,进货系统;3,查看列表;4,插入删除;5,销售盈亏;6,帮助文档");
gotoxy(32,24);
printf("按ESC键退出");
key();
}while(0);
}
key()
{
int ch;
loop:
do{
ch=bioskey(0);
}while(0);
switch(ch)
{
case 561:sell();break;
case 818:creat();break;
case 1075:print();break;
case 1332:go();break;
case 283:break;
default:
{
gotoxy(30,22);
printf("请按数字键选择!");
goto loop;
}
}
}
如果你不是为了学习用途,直接用蓝点产品管理系统好了,这些需求基本直接就实现了的。
#include"stdio.h"
#include conio.h
#include stdlib.h
//#include"FILE.h"
typedef struct shangpin
{
char name[20];
int biaohao;
int shuliang;
double jiage;
}Node;
typedef struct list
{
Node data;
struct list *next;
}List ,*Slist;
void charu(Slist s,Node x);
int caidan()
{
int i;
while(1)
{
system("cls");
printf("\n\t\t\t 商店销售管理系统\n\n");
printf("\t\t