本文目录一览:
c语言销售管理系统
#define N 30
struct production
{
int number;
char name[10];
int inprice;
int outprice;
int quantity;
}production[N];
void welcome()
{
int c;
printf(" ^^^^^^^ ^^^^^^^\n");
printf(" --------------------welcome--------------------\n");
printf(" #* *#\n");
printf(" #* sale of production management system *#\n");
printf(" #* *#\n");
printf(" ---------=====!what do you want to do!=====---------\n");
printf("\n");
printf(" **~~ 1 input ~~**\n");
printf(" **~~ 2 insert ~~**\n");
printf(" **~~ 3 search_name ~~**\n");
printf(" **~~ 4 search_number ~~**\n");
printf(" **~~ 5 delete ~~**\n");
printf(" **~~ 6 display ~~**\n");
printf(" **~~ 7 profit ~~**\n");
printf(" **~~ 8 sort ~~**\n");
printf("\n");
printf(" --------~~~~~~~~~~~~--------\n");
printf("\n");
printf("please input you choice(A number between 1 and 8):\n");
}
void input1(int i)
{
printf("Please input the data:\n");
printf("please input the number:\n");
scanf("%d",production[i].number);
printf("please input the name:\n");
scanf("%s",production[i].name);
printf("please input the inprice:\n");
scanf("%d",production[i].inprice);
printf("please input the outprice:\n");
scanf("%d",production[i].outprice);
printf("please input the quantity:\n");
scanf("%d",production[i].quantity);
}
void input()
{
int i,m=0;
char x;
for(i=0;iN;i++)
if(strlen(production[i].name)!=0)
m++;
for(i=m;iN-1;i++)
{
input1(i);
printf("Do you want to continue inputing new data\n");
x=getch();
if(x=='y'||x=='Y')
continue;
if(x=='n'||x=='N')
break;
}
}
int insert()
{
int i,m=0;
for(i=0;iN;i++)
if(strlen(production[i].name)!=0)
m++;
input1(m);
}
delete()
{
char n[10];
int i,j,b=0,m=0;
for(i=0;iN;i++)
if(strlen(production[i].name)!=0)
m++;
printf("Enter the name of the production which you want to delete!");
scanf("%s",n);
for(i=0;im;i++)
if(strcmp(production[i].name,n)==0)
{
for(j=i;j=m;j++)
production[j]=production[j+1];
b=1;
}
if(b==0)
printf("Not find you data!\n");
if(b==1)
printf("Succeed!The data has been deleted!\n");
}
void search_number()
{
int number,i,flag=0;
printf("Please enter number which you want to search:");
scanf("%d",number);
for(i=0;iN;i++)
if(production[i].number==number)
{
printf("the information of this number:\n");
printf("Number: %d\nName: %s\nInprice: %d\nOutprice: %d\nQuantity: %d\n",production[i].number,production[i].name,production[i].inprice,production[i].outprice,production[i].number);
flag=1;
}
if(flag==0)
printf("The number is not exist !\n");
}
void search_name()
{
char name[20];
int i,flag=0;
printf("Please enter name which you want to search:");
scanf("%s",name);
for(i=0;iN;i++)
if(strcmp(production[i].name,name)==0)
{
printf("the information of this name:\n");
printf("Number: %d\nName: %s\nInprice: %d\nOutprice: %d\nQuantity: %d\n",production[i].number,production[i].name,production[i].inprice,production[i].outprice,production[i].number);
flag=1;
}
if(flag==0)
printf("The name is not exist !\n");
}
void profit()
{
int p[N],pr=0,i,m=0;
for(i=0;iN;i++)
if(strlen(production[i].name)!=0)
m++;
for(i=0;im;i++)
{
p[i]=(production[i].outprice-production[i].inprice)*production[i].quantity;
pr=pr+p[i];
printf("Name: %-7s\tNumber: %-7d\tprofit: %-10d\n",production[i].name,production[i].number,p[i]);
}
printf("Total Profit: %d\n",pr);
}
void sort()
{ int i,j,t,s,m=0,b[N],a[N];
for(i=0;iN;i++)
if(strlen(production[i].name)!=0)
m++;
for(i=0;im;i++)
{
b[i]=production[i].outprice*production[i].quantity;
a[i]=production[i].number;
}
printf("Before sorted:\n");
for(i=0;im;i++)
printf("Number: %-5d\tSale: %-10d\n",a[i],b[i]);
for(i=1;im;i++)
for(j=0;jm-i;j++)
if(b[j]b[j+1])
{
t=b[j];
b[j]=b[j+1];
b[j+1]=t;
s=a[j];
a[j]=a[j+1];
a[j+1]=s;
}
printf("After sorted:\n");
for(i=0;im;i++)
printf("Number: %-5d\tSale: %-10d\n",a[i],b[i]);
}
void output()
{
int i,m=0;
for(i=0;iN;i++)
if(strlen(production[i].name)!=0)
m++;
printf("Disply all the data below:\n");
for(i=0;im;i++)
{
printf("The number: %d\n",production[i].number);
printf("The name: %s\n",production[i].name);
printf("The inprice: %d\n",production[i].inprice);
printf("The outprice: %d\n",production[i].outprice);
printf("The quantity: %d\n",production[i].quantity);
printf("\n");
}
}
main()
{
int c;
welcome();
while(1)
{
scanf("%d",c);
switch(c)
{
case 0:welcome();break;
case 1:input();printf("You may enter 0 to back to Welcome to look you choices!\n");break;
case 2:insert();printf("You may enter 0 to back to Welcome to look you choices!\n");break;
case 3:search_name();printf("You may enter 0 to back to Welcome to look you choices!\n");break;
case 4:search_number();printf("You may enter 0 to back to Welcome to look you choices!\n");break;
case 5:delete();printf("You may enter 0 to back to Welcome to look you choices!\n");break;
case 6:output();printf("You may enter 0 to back to Welcome to look you choices!\n");break;
case 7:profit();printf("You may enter 0 to back to Welcome to look you choices!\n");break;
case 8:sort();printf("You may enter 0 to back to Welcome to look you choices!\n");break;
}
}
}
用C语言编写一简单的商品销售管理系统
第一个功能商品入库其实就是输入数据 不要想得太复杂 直接用scanf输入就可以了
第二个商品销售 就是改一下商品的数量
查询用折半查找顺序查找都可以 查到之后printf
排序可以用选择法
用C语言编写“销售管理系统设计”程序
讲下设计思想吧
便条实际上包含了登陆信息了,所以省去了登陆环节,简单点做到如下几点就可以 了:
1、调用c的图形类创建一菜单,有便条录入、和信息查询两栏,信息查询下面再分各种查询
2、便条录入可以都不用图形界面了,直接按条目输入值,顺序输入即可
3、保存以文件形式,可以在第一次建立个txt文档,以制表符分割开来各个字段,但是每次写入的时候必须按行作为一条数据,可以适当增加需要的字段作为查询统计方便用(每个制表符分割的为一个字段)。
4、查询统计就直接检索这个txt文档,该加总的求平均的用循环去查即可。
5、结果输出即把查到的内容在屏幕上打印出来即可。
其他,如果用c++做就简单多了,没那么多代码写