c语言课设,要求设计一个产品管理系统。 具体要求如下,希望各位大侠多多帮忙!!! 急!!!!

2024-12-23 11:22:09
推荐回答(3个)
回答1:

貌似时间不够了

#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;i if(strlen(production[i].name)!=0)
m++;
for(i=m;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;i if(strlen(production[i].name)!=0)
m++;
input1(m);
}

delete()
{
char n[10];
int i,j,b=0,m=0;
for(i=0;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;iif(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;iif(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;iif(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;i if(strlen(production[i].name)!=0)
m++;
for(i=0;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;i if(strlen(production[i].name)!=0)
m++;
for(i=0;i{
b[i]=production[i].outprice*production[i].quantity;
a[i]=production[i].number;
}
printf("Before sorted:\n");
for(i=0;iprintf("Number: %-5d\tSale: %-10d\n",a[i],b[i]);
for(i=1;i for(j=0;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;iprintf("Number: %-5d\tSale: %-10d\n",a[i],b[i]);
}

void output()
{
int i,m=0;
for(i=0;i if(strlen(production[i].name)!=0)
m++;
printf("Disply all the data below:\n");
for(i=0;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;
}
}
}

回答2:

产品信息包括:产品编号、产品名称、生产厂家、生产日期、价格等。试设计一产品信息管理系统,使之能提供以下功能:
1、产品信息录入功能(图书信息用文件保存,也可不用)
2、产品信息浏览功能
3、排序:按生产时间排序
4、查询: (1.1)
按价格范围查询
5、产品信息的删除与修改(任选一项)

回答3:

#include
struct student
{
int num;//.......
}s[30];
void luru()
{
}
void tongji()
{
}
void sort1()
{
}
void find1()
{
}

void main()
{
int choice=1;
printf("欢迎使用本系统!!!\n");
while(choice!=5)
{
printf(" *************************\n");
printf(" * 主菜单 *\n");
printf(" * 1:学生成绩录入 *\n");
printf(" * 2:学生成绩统计 *\n");
printf(" * 3:学生成绩排序 *\n");
printf(" * 4:学生成绩查找 *\n");
printf(" * 5:退出 *\n");
printf(" *************************\n");
printf(" 请选择:");
scanf("%d",&choice);
switch(choice)
{
case 1:
luru();
break;
case 2:
tongji();
break;
case 3:
sort1();
break;
case 4:
find1();
break;
case 5:
printf("谢谢使用本系统!\n");
break;
default:
printf("选择错误,请重新选择!\n");
}
}
}