Changes to be committed:
deleted: proglabs/lab6/1.c new file: proglabs/lab6/10.c new file: proglabs/lab6/11.c modified: proglabs/lab6/2.c modified: proglabs/lab6/3.c new file: proglabs/lab6/4.c new file: proglabs/lab6/5.c new file: proglabs/lab6/6.c new file: proglabs/lab6/7.c new file: proglabs/lab6/8.c new file: proglabs/lab6/9.c
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#define arti 2.05
|
||||
#define svek 1.15
|
||||
#define carr 1.09
|
||||
|
||||
#define skid 0.05
|
||||
|
||||
#define zatrporog1 5
|
||||
#define zatrporog2 20
|
||||
#define zatrmin 6.50
|
||||
#define zatrsr 14.00
|
||||
#define zatrmax 0.5
|
||||
|
||||
int main() {
|
||||
int ch,a,s,c,tmp;
|
||||
float sk,st,zt;
|
||||
|
||||
printf("a - Artishok\nb - Svek\nc -Carrot\nq - quit\nInput: ");
|
||||
while((ch = getchar())!='q'){
|
||||
switch(ch){
|
||||
case 'a':
|
||||
printf("Arti: ");
|
||||
scanf("%d",&tmp);
|
||||
a+=tmp;
|
||||
break;
|
||||
case 'b':
|
||||
printf("svek: ");
|
||||
scanf("%d",&tmp);
|
||||
s+=tmp;
|
||||
break;
|
||||
case 'c':
|
||||
printf("Carrot: ");
|
||||
scanf("%d",&tmp);
|
||||
c+=tmp;
|
||||
break;
|
||||
}
|
||||
printf("\n\nzakaz:\nArti\tSvek\tCarrot\n%d\t%d\t%d\n",a,s,c);
|
||||
printf("a - Artishok\nb - Svek\nc - Carrot\nq - deal\nInput: ");
|
||||
}
|
||||
|
||||
if((a>0)||(s>0)||(c>0)){
|
||||
|
||||
st = ((a*arti)+(s*svek)+(c*carr));
|
||||
tmp = (a+s+c);
|
||||
if(tmp>zatrporog1){
|
||||
if(tmp>zatrporog2){
|
||||
zt=(zatrsr+((tmp-zatrporog2)*zatrmax));
|
||||
}else(zt=zatrsr);
|
||||
}else(zt=zatrmin);
|
||||
if(st>100){sk=(st+zt)*skid;}
|
||||
|
||||
printf("zakaz: arti-%d Svek-%d Carr-%d\n",a,s,c);
|
||||
printf("Arti-%d sum-%0.2f stoimost-%0.2f/1\n",a,a*arti,arti);
|
||||
printf("Svek-%d sum-%0.2f stoimost-%0.2f/1\n",s,s*svek,svek);
|
||||
printf("Carrot-%d sum-%0.2f stoimost-%0.2f/1\n",c,c*carr,carr);
|
||||
printf("stoimost-%.2f skidka-%.2f zatrat-%.2f\nitogo: %.2f",st,sk,zt,zt+st-sk);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user