|
|
#include<stdio.h>
|
|
|
#include<stdlib.h>
|
|
|
void menue()
|
|
|
{
|
|
|
int z;
|
|
|
int m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,c1,c2,c3,c4,c5,A,B,D,E,F,G,H,I,J,K,L,N,O,P,Q,R,Z,T,X,Y;
|
|
|
int M[4][5]={{m1,m2,m3,m4,m5},{m6,m7,m8,m9,m10},{m11,m12,m13,m14,m15},{m16,m17,m18,m19,m20}};
|
|
|
int S[4][5]={{s1,s2,s3,s4,s5},{s6,s7,s8,s9,s10},{s11,s12,s13,s14,s15},{s16,s17,s18,s19,s20}};
|
|
|
int C[5]={c1,c2,c3,c4,c5};
|
|
|
printf("请输入每种产品的单价,每种产品每周生产量和销售量:\n");
|
|
|
printf("产品单价:\n");
|
|
|
printf(" (1) (2) (3) (4) (5)\n");
|
|
|
printf("价格(元):");
|
|
|
scanf("%d %d %d %d %d",&c1,&c2,&c3,&c4,&c5);
|
|
|
printf("生产量:\n");
|
|
|
printf(" (1) (2) (3) (4) (5)\n");
|
|
|
printf("第一周:");
|
|
|
scanf("%d %d %d %d %d",&m1,&m2,&m3,&m4,&m5);
|
|
|
printf("第二周:");
|
|
|
scanf("%d %d %d %d %d",&m6,&m7,&m8,&m9,&m10);
|
|
|
printf("第三周:");
|
|
|
scanf("%d %d %d %d %d",&m11,&m12,&m13,&m14,&m15);
|
|
|
printf("第四周:");
|
|
|
scanf("%d %d %d %d %d",&m16,&m17,&m18,&m19,&m20);
|
|
|
printf("销售量:\n");
|
|
|
printf("第一周:");
|
|
|
scanf("%d %d %d %d %d",&s1,&s2,&s3,&s4,&s5);
|
|
|
printf("第二周:");
|
|
|
scanf("%d %d %d %d %d",&s6,&s7,&s8,&s9,&s10);
|
|
|
printf("第三周:");
|
|
|
scanf("%d %d %d %d %d",&s11,&s12,&s13,&s14,&s15);
|
|
|
printf("第四周:");
|
|
|
scanf("%d %d %d %d %d",&s16,&s17,&s18,&s19,&s20);
|
|
|
m1=m1*c1;m2=m2*c2;m3=m3*c3;m4=m4*c4;m5=m5*c5;
|
|
|
m6=m6*c1;m7=m7*c2;m8=m8*c3;m9=m9*c4;m10=m10*c5;
|
|
|
m11=m11*c1;m12=m12*c2;m13=m13*c3;m14=m14*c4;m15=m15*c5;
|
|
|
m16=m16*c1;m17=m17*c2;m18=m18*c3;m19=m19*c4;m20=m20*c5;
|
|
|
s1=s1*c1;s2=s2*c2;s3=s3*c3;s4=s4*c4;s5=s5*c5;
|
|
|
s6=s6*c1;s7=s7*c2;s8=s8*c3;s9=s9*c4;s10=s10*c5;
|
|
|
s11=s11*c1;s12=s12*c2;s13=s13*c3;s14=s14*c4;s15=s15*c5;
|
|
|
s16=s16*c1;s17=s17*c2;s18=s18*c3;s19=s19*c4;s20=s20*c5;
|
|
|
A=m1+m2+m3+m4+m5;B=m6+m7+m8+m9+m10+m11;
|
|
|
D=m11+m12+m13+m14+m15;E=m16+m17+m18+m19+m20;
|
|
|
F=s1+s2+s3+s4+s5;G=s6+s7+s8+s9+s10;
|
|
|
H=s11+s12+s13+s14+s15;I=s16+s17+s18+s19+s20;
|
|
|
J=m1+m6+m11+m16;K=m2+m7+m12+m17;L=m3+m7+m13+m18;N=m4+m8+m14+m19;O=m5+m10+m15+m20;
|
|
|
P=s1+s6+s11+s16;Q=s2+s7+s12+s17;R=s3+s7+s13+s18;Z=s4+s8+s14+s19;T=s5+s10+s15+s20;
|
|
|
X=A+B+D+E;
|
|
|
Y=F+G+H+I;
|
|
|
while(1)
|
|
|
|
|
|
{
|
|
|
printf("\n***************************************");
|
|
|
printf("\n选择您需要的数据(选择序号): *");
|
|
|
printf("\n1.每种产品每周的生产值和销售值 *");
|
|
|
printf("\n2.每周所有产品的生产值和销售值 *");
|
|
|
printf("\n3.每种产品一个月内的生产值和销售值 *");
|
|
|
printf("\n4.所有产品一个月的生产总值和销售总值 *");
|
|
|
printf("\n5.结束 *");
|
|
|
printf("\n***************************************\n");
|
|
|
printf("序号数:");
|
|
|
scanf("%d",&z);
|
|
|
|
|
|
switch(z)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 1: printf("每种产品每周的生产值:\n (1) (2) (3) (4) (5)\nWeek(1)= %d %d %d %d %d\nWeek(2)= %d %d %d %d %d\nWeek(3)= %d %d %d %d %d\nWeek(4)= %d %d %d %d %d\n每种产品每周的销售值:\n (1) (2) (3) (4) (5)\nWeek(1)= %d %d %d %d %d\nWeek(2)= %d %d %d %d %d\nWeek(3)= %d %d %d %d %d\nWeek(4)= %d %d %d %d %d\n",m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20);break;
|
|
|
|
|
|
case 2: printf("每周所有产品的生产值和销售值:\n (产) (销)\nWeek(1)= %d %d\nWeek(2)= %d %d\nWeek(3)= %d %d\nWeek(4)= %d %d\n",A,F,B,G,D,H,E,I);break;
|
|
|
|
|
|
case 3: printf("每种产品一个月内的生产值和销售值:\n (产) (销)\nProduct(1)= %d %d\nProduct(2)= %d %d\nProduct(3)= %d %d\nProduct(4)= %d %d\nProduct(5)= %d %d\n",J,P,K,Q,L,R,N,Z,O,T);break;
|
|
|
|
|
|
case 4: printf("所有产品一个月的生产总值和销售总值:\nTotal product=%d\nTotal sales=%d\n",X,Y);break;
|
|
|
|
|
|
case 5: exit(0);break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
int main(void)
|
|
|
{
|
|
|
system("color b0");
|
|
|
menue();
|
|
|
return 0;
|
|
|
}
|
|
|
|