Orribile prima versione scritta da Samuele
This commit is contained in:
1 file changed
+741
@@ -0,0 +1,741 @@
|
|||||||
|
#include<stdio.h>
|
||||||
|
int main(void){
|
||||||
|
|
||||||
|
char control;
|
||||||
|
int selector;
|
||||||
|
int num;
|
||||||
|
int add;
|
||||||
|
int sp, sp5, sg, sg3, spi, spi5, c, c5, sh, sh2, t, t3, bo, bo3, bi, bi3, mh, mh3, p, o, b, shv, shv2, mhv, mhv3;
|
||||||
|
float p_sp = 0.5;
|
||||||
|
int p_sp5 = 2;
|
||||||
|
int p_sg = 1;
|
||||||
|
int p_sg3 = 2;
|
||||||
|
int p_spi = 1;
|
||||||
|
int p_spi5 = 4;
|
||||||
|
int p_c = 3;
|
||||||
|
int p_c5 = 10;
|
||||||
|
int p_sh = 3;
|
||||||
|
int p_sh2 = 5;
|
||||||
|
int p_t = 6;
|
||||||
|
int p_t3 = 12;
|
||||||
|
int p_bo = 5;
|
||||||
|
int p_bo3 = 11;
|
||||||
|
int p_mh = 10;
|
||||||
|
int p_mh3 = 25;
|
||||||
|
int p_p = 3;
|
||||||
|
int p_o = 1;
|
||||||
|
int p_b = 1;
|
||||||
|
int p_shv = 3;
|
||||||
|
int p_shv2 = 5;
|
||||||
|
int p_mhv = 10;
|
||||||
|
int p_mhv3 = 25;
|
||||||
|
float r_sp, tot;
|
||||||
|
float r_sg, r_spi, r_c, r_sh, r_t, r_bo, r_bi, r_mh, r_p, r_o, r_b, r_shv, r_mhv;
|
||||||
|
FILE *ptRsp = NULL;
|
||||||
|
FILE *ptWsp = NULL;
|
||||||
|
FILE *ptRsp5 = NULL;
|
||||||
|
FILE *ptWsp5 = NULL;
|
||||||
|
FILE *ptRsg = NULL;
|
||||||
|
FILE *ptWsg = NULL;
|
||||||
|
FILE *ptRsg3 = NULL;
|
||||||
|
FILE *ptWsg3 = NULL;
|
||||||
|
FILE *ptRspi = NULL;
|
||||||
|
FILE *ptWspi = NULL;
|
||||||
|
FILE *ptRspi5 = NULL;
|
||||||
|
FILE *ptWspi5 = NULL;
|
||||||
|
FILE *ptRc = NULL;
|
||||||
|
FILE *ptWc = NULL;
|
||||||
|
FILE *ptRc5 = NULL;
|
||||||
|
FILE *ptWc5 = NULL;
|
||||||
|
FILE *ptRsh = NULL;
|
||||||
|
FILE *ptWsh = NULL;
|
||||||
|
FILE *ptRsh2 = NULL;
|
||||||
|
FILE *ptWsh2 = NULL;
|
||||||
|
FILE *ptRt = NULL;
|
||||||
|
FILE *ptWt = NULL;
|
||||||
|
FILE *ptRt3 = NULL;
|
||||||
|
FILE *ptWt3 = NULL;
|
||||||
|
FILE *ptRbo = NULL;
|
||||||
|
FILE *ptWbo = NULL;
|
||||||
|
FILE *ptRbo3 = NULL;
|
||||||
|
FILE *ptWbo3 = NULL;
|
||||||
|
FILE *ptRbi = NULL;
|
||||||
|
FILE *ptWbi = NULL;
|
||||||
|
FILE *ptRbi3 = NULL;
|
||||||
|
FILE *ptWbi3 = NULL;
|
||||||
|
FILE *ptRmh = NULL;
|
||||||
|
FILE *ptWmh = NULL;
|
||||||
|
FILE *ptRmh3 = NULL;
|
||||||
|
FILE *ptWmh3 = NULL;
|
||||||
|
FILE *ptRp = NULL;
|
||||||
|
FILE *ptWp = NULL;
|
||||||
|
FILE *ptRo = NULL;
|
||||||
|
FILE *ptWo = NULL;
|
||||||
|
FILE *ptRb = NULL;
|
||||||
|
FILE *ptWb = NULL;
|
||||||
|
FILE *ptRshv = NULL;
|
||||||
|
FILE *ptWshv = NULL;
|
||||||
|
FILE *ptRshv2 = NULL;
|
||||||
|
FILE *ptWshv2 = NULL;
|
||||||
|
FILE *ptRmhv = NULL;
|
||||||
|
FILE *ptWmhv = NULL;
|
||||||
|
FILE *ptRmhv3 = NULL;
|
||||||
|
FILE *ptWmhv3 = NULL;
|
||||||
|
|
||||||
|
while(1){
|
||||||
|
printf("0 sticker piccoli\n50 sticker piccoli x5\n1 sticker grandi\n31 sticker grandi x3\n2 spillette\n52 spillette x5\n3 clipper\n53 clipper x5\n4 shopper\n24 shopper x2\n5 tazza\n35 tazza x3\n6 maglietta bordò\n36 maglietta bordò x3\n7 maglietta bianca\n37 maglietta bianca x3\n8 maglietta high\n38 maglietta high x3\n9 portachiavi\n10 occhiali da sole\n11 blocco note\n12 borse vecchie\n212 borse vecchie x2\n13maglietta high vecchia\n313 maglietta high vecchia x3\n100 resoconto\n198456 reset file\n");
|
||||||
|
if( control = scanf("%d", &selector) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch(selector){
|
||||||
|
case 0:
|
||||||
|
ptRsp = fopen("sp","r");
|
||||||
|
if (ptRsp == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRsp,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRsp);
|
||||||
|
ptWsp = fopen("sp","w");
|
||||||
|
fprintf(ptWsp,"%d",num);
|
||||||
|
fclose(ptWsp);
|
||||||
|
break;
|
||||||
|
case 50:
|
||||||
|
ptRsp5 = fopen("sp5","r");
|
||||||
|
if (ptRsp5 == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRsp5,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRsp5);
|
||||||
|
ptWsp5 = fopen("sp5","w");
|
||||||
|
fprintf(ptWsp5,"%d",num);
|
||||||
|
fclose(ptWsp5);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
ptRsg = fopen("sg","r");
|
||||||
|
if (ptRsg == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRsg,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRsg);
|
||||||
|
ptWsg = fopen("sg","w");
|
||||||
|
fprintf(ptWsg,"%d",num);
|
||||||
|
fclose(ptWsg);
|
||||||
|
break;
|
||||||
|
case 31:
|
||||||
|
ptRsg3 = fopen("sg3","r");
|
||||||
|
if (ptRsg3 == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRsg3,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRsg3);
|
||||||
|
ptWsg3 = fopen("sg3","w");
|
||||||
|
fprintf(ptWsg3,"%d",num);
|
||||||
|
fclose(ptWsg3);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
ptRspi = fopen("spi","r");
|
||||||
|
if (ptRsg == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRspi,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRspi);
|
||||||
|
ptWspi = fopen("spi","w");
|
||||||
|
fprintf(ptWspi,"%d",num);
|
||||||
|
fclose(ptWspi);
|
||||||
|
break;
|
||||||
|
case 52:
|
||||||
|
ptRspi5 = fopen("spi5","r");
|
||||||
|
if (ptRspi5 == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRspi5,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRspi5);
|
||||||
|
ptWspi5 = fopen("spi5","w");
|
||||||
|
fprintf(ptWspi5,"%d",num);
|
||||||
|
fclose(ptWspi5);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
ptRc = fopen("c","r");
|
||||||
|
if (ptRc == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRc,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRc);
|
||||||
|
ptWc = fopen("c","w");
|
||||||
|
fprintf(ptWc,"%d",num);
|
||||||
|
fclose(ptWc);
|
||||||
|
break;
|
||||||
|
case 53:
|
||||||
|
ptRc5 = fopen("c5","r");
|
||||||
|
if (ptRc5 == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRc5,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRc5);
|
||||||
|
ptWc5 = fopen("c5","w");
|
||||||
|
fprintf(ptWc5,"%d",num);
|
||||||
|
fclose(ptWc5);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
ptRsh = fopen("sh","r");
|
||||||
|
if (ptRsh == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRsh,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRsh);
|
||||||
|
ptWsh = fopen("sh","w");
|
||||||
|
fprintf(ptWsh,"%d",num);
|
||||||
|
fclose(ptWsh);
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
ptRsh2 = fopen("sh2","r");
|
||||||
|
if (ptRsh2 == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRsh2,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRsh2);
|
||||||
|
ptWsh2 = fopen("sh2","w");
|
||||||
|
fprintf(ptWsh2,"%d",num);
|
||||||
|
fclose(ptWsh2);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
ptRt = fopen("t","r");
|
||||||
|
if (ptRt == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRt,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRt);
|
||||||
|
ptWt = fopen("t","w");
|
||||||
|
fprintf(ptWt,"%d",num);
|
||||||
|
fclose(ptWt);
|
||||||
|
break;
|
||||||
|
case 35:
|
||||||
|
ptRt3 = fopen("t3","r");
|
||||||
|
if (ptRt3 == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRt3,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRt3);
|
||||||
|
ptWt3 = fopen("t3","w");
|
||||||
|
fprintf(ptWt3,"%d",num);
|
||||||
|
fclose(ptWt3);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
ptRbo = fopen("bo","r");
|
||||||
|
if (ptRbo == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRbo,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRbo);
|
||||||
|
ptWbo = fopen("bo","w");
|
||||||
|
fprintf(ptWbo,"%d",num);
|
||||||
|
fclose(ptWbo);
|
||||||
|
break;
|
||||||
|
case 36:
|
||||||
|
ptRbo3 = fopen("bo3","r");
|
||||||
|
if (ptRbo3 == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRbo3,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRbo3);
|
||||||
|
ptWbo3 = fopen("bo3","w");
|
||||||
|
fprintf(ptWbo3,"%d",num);
|
||||||
|
fclose(ptWbo3);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
ptRbi = fopen("bi","r");
|
||||||
|
if (ptRbi == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRbi,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRbi);
|
||||||
|
ptWbi = fopen("bi","w");
|
||||||
|
fprintf(ptWbi,"%d",num);
|
||||||
|
fclose(ptWbi);
|
||||||
|
break;
|
||||||
|
case 37:
|
||||||
|
ptRbi3 = fopen("bi3","r");
|
||||||
|
if (ptRbi3 == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRbi3,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRbi3);
|
||||||
|
ptWbi3 = fopen("bi3","w");
|
||||||
|
fprintf(ptWbi3,"%d",num);
|
||||||
|
fclose(ptWbi3);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
ptRmh = fopen("mh","r");
|
||||||
|
if (ptRmh == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRmh,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRmh);
|
||||||
|
ptWmh = fopen("mh","w");
|
||||||
|
fprintf(ptWmh,"%d",num);
|
||||||
|
fclose(ptWmh);
|
||||||
|
break;
|
||||||
|
case 38:
|
||||||
|
ptRmh3 = fopen("mh3","r");
|
||||||
|
if (ptRmh3 == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRmh3,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRmh3);
|
||||||
|
ptWmh3 = fopen("mh3","w");
|
||||||
|
fprintf(ptWmh3,"%d",num);
|
||||||
|
fclose(ptWmh3);
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
ptRp = fopen("p","r");
|
||||||
|
if (ptRp == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRp,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRp);
|
||||||
|
ptWp = fopen("p","w");
|
||||||
|
fprintf(ptWp,"%d",num);
|
||||||
|
fclose(ptWp);
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
ptRo = fopen("o","r");
|
||||||
|
if (ptRo == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRo,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRo);
|
||||||
|
ptWo = fopen("o","w");
|
||||||
|
fprintf(ptWo,"%d",num);
|
||||||
|
fclose(ptWo);
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
ptRb = fopen("b","r");
|
||||||
|
if (ptRb == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRb,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRb);
|
||||||
|
ptWb = fopen("b","w");
|
||||||
|
fprintf(ptWb,"%d",num);
|
||||||
|
fclose(ptWb);
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
ptRshv = fopen("shv","r");
|
||||||
|
if (ptRshv == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRshv,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRshv);
|
||||||
|
ptWshv = fopen("shv","w");
|
||||||
|
fprintf(ptWshv,"%d",num);
|
||||||
|
fclose(ptWshv);
|
||||||
|
break;
|
||||||
|
case 212:
|
||||||
|
ptRshv2 = fopen("shv2","r");
|
||||||
|
if (ptRshv2 == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRshv2,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRshv2);
|
||||||
|
ptWshv2 = fopen("shv2","w");
|
||||||
|
fprintf(ptWshv2,"%d",num);
|
||||||
|
fclose(ptWshv2);
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
ptRmhv = fopen("mhv","r");
|
||||||
|
if (ptRmhv == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRmhv,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRmhv);
|
||||||
|
ptWmhv = fopen("mhv","w");
|
||||||
|
fprintf(ptWmhv,"%d",num);
|
||||||
|
fclose(ptWmhv);
|
||||||
|
break;
|
||||||
|
case 313:
|
||||||
|
ptRmhv3 = fopen("mhv3","r");
|
||||||
|
if (ptRmhv3 == NULL){
|
||||||
|
printf("file non aperto\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fscanf(ptRmhv3,"%d", &num);
|
||||||
|
printf("quantità venduta?\n");
|
||||||
|
if( control = scanf("%d", &add) != 1){
|
||||||
|
if(control == EOF) break;
|
||||||
|
scanf("%*[^\n\r]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = num + add;
|
||||||
|
fclose(ptRmhv3);
|
||||||
|
ptWmhv3 = fopen("mhv3","w");
|
||||||
|
fprintf(ptWmhv3,"%d",num);
|
||||||
|
fclose(ptWmhv3);
|
||||||
|
break;
|
||||||
|
case 100:
|
||||||
|
ptRsp = fopen("sp","r");
|
||||||
|
fscanf(ptRsp,"%d",&sp);
|
||||||
|
fclose(ptRsp);
|
||||||
|
ptRsp5 = fopen("sp5","r");
|
||||||
|
fscanf(ptRsp5,"%d",&sp5);
|
||||||
|
fclose(ptRsp5);
|
||||||
|
ptRsg = fopen("sg","r");
|
||||||
|
fscanf(ptRsg,"%d",&sg);
|
||||||
|
fclose(ptRsg);
|
||||||
|
ptRsg3 = fopen("sg3","r");
|
||||||
|
fscanf(ptRsg3,"%d",&sg3);
|
||||||
|
fclose(ptRsg3);
|
||||||
|
ptRspi = fopen("spi","r");
|
||||||
|
fscanf(ptRspi,"%d",&spi);
|
||||||
|
fclose(ptRspi);
|
||||||
|
ptRspi5 = fopen("spi5","r");
|
||||||
|
fscanf(ptRspi5,"%d",&spi5);
|
||||||
|
fclose(ptRspi5);
|
||||||
|
ptRc = fopen("c","r");
|
||||||
|
fscanf(ptRc,"%d",&c);
|
||||||
|
fclose(ptRc);
|
||||||
|
ptRc5 = fopen("c5","r");
|
||||||
|
fscanf(ptRc5,"%d",&c5);
|
||||||
|
fclose(ptRc5);
|
||||||
|
ptRsh = fopen("sh","r");
|
||||||
|
fscanf(ptRsh,"%d",&sh);
|
||||||
|
fclose(ptRsh);
|
||||||
|
ptRsh2 = fopen("sh2","r");
|
||||||
|
fscanf(ptRsh2,"%d",&sh2);
|
||||||
|
fclose(ptRsh2);
|
||||||
|
ptRt = fopen("t","r");
|
||||||
|
fscanf(ptRt,"%d",&t);
|
||||||
|
fclose(ptRt);
|
||||||
|
ptRt3 = fopen("t3","r");
|
||||||
|
fscanf(ptRt3,"%d",&t3);
|
||||||
|
fclose(ptRt3);
|
||||||
|
ptRbo = fopen("bo","r");
|
||||||
|
fscanf(ptRbo,"%d",&bo);
|
||||||
|
fclose(ptRbo);
|
||||||
|
ptRbo3 = fopen("bo3","r");
|
||||||
|
fscanf(ptRbo3,"%d",&bo3);
|
||||||
|
fclose(ptRbo3);
|
||||||
|
ptRbi = fopen("bi","r");
|
||||||
|
fscanf(ptRbi,"%d",&bi);
|
||||||
|
fclose(ptRbi);
|
||||||
|
ptRbi3 = fopen("bi3","r");
|
||||||
|
fscanf(ptRbi3,"%d",&bi3);
|
||||||
|
fclose(ptRbi3);
|
||||||
|
ptRmh = fopen("mh","r");
|
||||||
|
fscanf(ptRmh,"%d",&mh);
|
||||||
|
fclose(ptRmh);
|
||||||
|
ptRmh3 = fopen("mh3","r");
|
||||||
|
fscanf(ptRmh3,"%d",&mh3);
|
||||||
|
fclose(ptRmh3);
|
||||||
|
ptRp = fopen("p","r");
|
||||||
|
fscanf(ptRp,"%d",&p);
|
||||||
|
fclose(ptRp);
|
||||||
|
ptRo = fopen("o","r");
|
||||||
|
fscanf(ptRo,"%d",&o);
|
||||||
|
fclose(ptRo);
|
||||||
|
ptRb = fopen("b","r");
|
||||||
|
fscanf(ptRb,"%d",&b);
|
||||||
|
fclose(ptRb);
|
||||||
|
ptRshv = fopen("shv","r");
|
||||||
|
fscanf(ptRshv,"%d",&shv);
|
||||||
|
fclose(ptRshv);
|
||||||
|
ptRshv2 = fopen("shv2","r");
|
||||||
|
fscanf(ptRshv2,"%d",&shv2);
|
||||||
|
fclose(ptRshv2);
|
||||||
|
ptRmhv = fopen("mhv","r");
|
||||||
|
fscanf(ptRmhv,"%d",&mhv);
|
||||||
|
fclose(ptRmhv);
|
||||||
|
ptRmhv3 = fopen("mhv3","r");
|
||||||
|
fscanf(ptRmhv3,"%d",&mhv3);
|
||||||
|
fclose(ptRmhv3);
|
||||||
|
r_sp = sp*p_sp + (sp5/5)*p_sp5;
|
||||||
|
r_sg = sg*p_sg + (sg3/3)*p_sg3;
|
||||||
|
r_spi = spi*p_spi + (spi5/5)*p_spi5;
|
||||||
|
r_c = c*p_c + (c5/5)*p_c5;
|
||||||
|
r_sh = sh*p_sh + (sh2/2)*p_sh2;
|
||||||
|
r_t = t*p_t + (t3/3)*p_t3;
|
||||||
|
r_bo = bo*p_bo + (bo3/3)*p_bo3;
|
||||||
|
r_bi = bi*p_bo + (bi3/3)*p_bo3;
|
||||||
|
r_mh = mh*p_mh + (mh3/3)*p_mh3;
|
||||||
|
r_p = p*p_p;
|
||||||
|
r_o = o*p_o;
|
||||||
|
r_b = b*p_b;
|
||||||
|
r_shv = shv*p_shv + (shv2/2)*p_shv2;
|
||||||
|
r_mhv = mhv*p_mhv + (mhv3/3)*p_mhv3;
|
||||||
|
tot = r_sp + r_sg + r_spi + r_c + r_sh + r_t + r_bo + r_bi + r_mh + r_p + r_o + r_b + r_shv + r_mhv;
|
||||||
|
printf("resoconto vendite\nsticker piccoli %d di cui in bundle %d con un guadagno di %.02f euro\nsticker grandi %d di cui in bundle %d con un guadagno di %.02f euro\nspillette %d di cui in bundle %d con un guadagno di %.02f euro\nclipper %d di cui in bundle %d con un guadagno di %.02f euro\nshopper %d di cui in bundle %d con un guadagno di %.02f euro\ntazze %d di cui in bundle %d con un guadagno di %.02f euro\nmagliette bordò %d di cui in bundle %d con un guadagno di %.02f euro\nmagliette bianche %d di cui in bundle %d con un guadagno di %.02f euro\nmagliette high %d di cui in bundle %d con un guadagno di %.02f euro\nportachiavi %d con un guadagno di %.02f euro\nocchiali da sole %d con un guadagno di %.02f euro\nblocco note %d con un guadagno di %.02f euro\nborse vecchie %d di cui in bundle %d con un guadagno in euro di %.02f euro\nmagliette high vecchie %d di cui in bundle %d con un guadagno di %.02f euro\nguadagno totale di %.02f\n", sp+sp5, sp5, r_sp, sg+sg3, sg3, r_sg, spi+spi5, spi5,r_spi, c+c5, c5, r_c, sh+sh2, sh2,r_sh, t+t3, t3, r_t, bo+bo3, bo3, r_bo, bi+bi3, bi3, r_bi, mh+mh3, mh3,r_mh, p, r_p, o, r_o, b, r_b, shv+shv2, shv2, r_shv, mhv+mhv3, mhv3, r_mhv, tot);
|
||||||
|
break;
|
||||||
|
case 198456:
|
||||||
|
ptWsp = fopen("sp","w");
|
||||||
|
fprintf(ptWsp,"0");
|
||||||
|
fclose(ptWsp);
|
||||||
|
ptWsp5 = fopen("sp5","w");
|
||||||
|
fprintf(ptWsp5,"0");
|
||||||
|
fclose(ptWsp5);
|
||||||
|
ptWsg = fopen("sg","w");
|
||||||
|
fprintf(ptWsg,"0");
|
||||||
|
fclose(ptWsg);
|
||||||
|
ptWsg3 = fopen("sg3","w");
|
||||||
|
fprintf(ptWsg3,"0");
|
||||||
|
fclose(ptWsg3);
|
||||||
|
ptWspi = fopen("spi","w");
|
||||||
|
fprintf(ptWspi,"0");
|
||||||
|
fclose(ptWspi);
|
||||||
|
ptWspi5 = fopen("spi5","w");
|
||||||
|
fprintf(ptWspi5,"0");
|
||||||
|
fclose(ptWspi5);
|
||||||
|
ptWc = fopen("c","w");
|
||||||
|
fprintf(ptWc,"0");
|
||||||
|
fclose(ptWc);
|
||||||
|
ptWc5 = fopen("c5","w");
|
||||||
|
fprintf(ptWc5,"0");
|
||||||
|
fclose(ptWc5);
|
||||||
|
ptWsh = fopen("sh","w");
|
||||||
|
fprintf(ptWsh,"0");
|
||||||
|
fclose(ptWsh);
|
||||||
|
ptWsh2 = fopen("sh2","w");
|
||||||
|
fprintf(ptWsh2,"0");
|
||||||
|
fclose(ptWsh2);
|
||||||
|
ptWt = fopen("t","w");
|
||||||
|
fprintf(ptWt,"0");
|
||||||
|
fclose(ptWt);
|
||||||
|
ptWt3 = fopen("t3","w");
|
||||||
|
fprintf(ptWt3,"0");
|
||||||
|
fclose(ptWt3);
|
||||||
|
ptWbo = fopen("bo","w");
|
||||||
|
fprintf(ptWbo,"0");
|
||||||
|
fclose(ptWbo);
|
||||||
|
ptWbo3 = fopen("bo3","w");
|
||||||
|
fprintf(ptWbo3,"0");
|
||||||
|
fclose(ptWbo3);
|
||||||
|
ptWbi = fopen("bi","w");
|
||||||
|
fprintf(ptWbi,"0");
|
||||||
|
fclose(ptWbi);
|
||||||
|
ptWbi3 = fopen("bi3","w");
|
||||||
|
fprintf(ptWbi3,"0");
|
||||||
|
fclose(ptWbi3);
|
||||||
|
ptWmh = fopen("mh","w");
|
||||||
|
fprintf(ptWmh,"0");
|
||||||
|
fclose(ptWmh);
|
||||||
|
ptWmh3 = fopen("mh3","w");
|
||||||
|
fprintf(ptWmh3,"0");
|
||||||
|
fclose(ptWmh3);
|
||||||
|
ptWp = fopen("p","w");
|
||||||
|
fprintf(ptWp,"0");
|
||||||
|
fclose(ptWp);
|
||||||
|
ptWo = fopen("o","w");
|
||||||
|
fprintf(ptWo,"0");
|
||||||
|
fclose(ptWo);
|
||||||
|
ptWb = fopen("b","w");
|
||||||
|
fprintf(ptWb,"0");
|
||||||
|
fclose(ptWb);
|
||||||
|
ptWshv = fopen("shv","w");
|
||||||
|
fprintf(ptWshv,"0");
|
||||||
|
fclose(ptWshv);
|
||||||
|
ptWshv2 = fopen("shv2","w");
|
||||||
|
fprintf(ptWshv2,"0");
|
||||||
|
fclose(ptWshv2);
|
||||||
|
ptWmhv = fopen("mhv","w");
|
||||||
|
fprintf(ptWmhv,"0");
|
||||||
|
fclose(ptWmhv);
|
||||||
|
ptWmhv3 = fopen("mhv3","w");
|
||||||
|
fprintf(ptWmhv3,"0");
|
||||||
|
fclose(ptWmhv3);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user