From 34be285963ba587c554347caf2107059a6c0b47e Mon Sep 17 00:00:00 2001 From: Peter Petrek Date: Fri, 8 Oct 2021 01:16:59 +0200 Subject: [PATCH] moze byt --- cv1/Makefile | 11 +++++++++ cv1/program | Bin 5266 -> 7338 bytes cv1/program.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 cv1/Makefile diff --git a/cv1/Makefile b/cv1/Makefile new file mode 100644 index 0000000..f78f641 --- /dev/null +++ b/cv1/Makefile @@ -0,0 +1,11 @@ +# variables +CC=gcc +CFLAGS=-std=c11 -Wall -Werror +LDLIBS=-lm +OUTPUT=$@ + +# targets +%: %.c + $(CC) $(CFLAGS) $@.c $(LDLIBS) -o $(OUTPUT) + + diff --git a/cv1/program b/cv1/program index e7206f884afe475d1932869fbc02ab18fef9c24a..6753e909ac5d2b86e69184b06a41ee199eaf2fca 100755 GIT binary patch literal 7338 zcmb7JeQ=b;8Q)6|JS1KM#EOv0O*s^6IRXYmX={$;_%dLG@L@q-E_avQ!R79H_Z}ur zY@ru~G|4pMP-|Os#A%(e@`qCyq?WOPVB$wVB5kcs?HH%hNd%@?5aZ|d_uIV-+edV_th-5*=$0m0#PW4N*=H~Dv-ZktTYwEB^+Y5m?6rDUwRsC?miW>e&ZnIrz)bH>DbwqII>W%;2ITAr^Jo9TYhhi~cU?0Y8_t{khRd{oH79 zPBaorH+xcX&wOPYuF0`2TfI)UrJro$g0SyW2xCKi?48pOUNmFBy8V@#j-0)J!Je6? zzWU)L=q5wpx=h4Q$V3GN9|hbVO|v7Tk z&e?J}vhLs=|Lkd8=cjs1`n3gdJpFlCkB8MR$WK_vCGvl%0dnFW<>CAD@S}OSEf3#d z!7h}avS8Z(V;){;!7h|n=HcI1Fx$r)e!nRet4KdSLGAuwN>I8PP|V@2I6 zBN$4C8Y3w)l&o7-6^+M2b^iKjNEk+AQ#@v*On=fe3}LL?VXVpVs-pf>DwI;qFWVSh z1aud7!bUI>G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08465 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -5,10 +5,13 @@ #include #include +#define velkost strlen #define size 100 +void hacker_script(char *string, int len); + struct pizza { - char meno[size]; + char name[size]; float price; }; @@ -17,11 +20,67 @@ int main() { struct pizza listok[size]; char input[100]= {0}; char keyword[size] = {0}; - - printf("Zadaj hladanu surovinu:"); + char kopia[size] = {0}; + int pomocna[size] = {0}; + float cena = 0; + int counter = 0; + int helper = 2; + int yes = 0; + int y = 0; + char * pch; + + printf("Zadaj hladanu surovinu:\n"); fgets(keyword, sizeof(keyword), stdin); + keyword[velkost(keyword)-1] = '\0'; + hacker_script(keyword, strlen(keyword)); + printf("Zadaj jedalny listok:\n"); + while(fgets(input, sizeof(input), stdin) && strcmp( input, "\n" ) != 0 ){ + if(helper %2 == 0){ + strcpy(listok[counter].name, input); + yes++; + } + else{ + cena = strtof(input, NULL); + listok[counter].price = cena; + yes++; + } + if(yes == 2){ + counter++; + yes = 0; + } + helper++; + } - printf("%s", keyword); + for(int x=0; x