From d09136c0cbe1bb575085d94b38f92936268c881f Mon Sep 17 00:00:00 2001 From: Yaroslav Orlianskyi Date: Wed, 30 Mar 2022 23:43:10 +0200 Subject: [PATCH] SAD --- du4/program | Bin 6010 -> 5722 bytes du4/program.c | 32 +++++++++++++------------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/du4/program b/du4/program index dce0973ec5ce04b08f0ad4ff5be97f3b715cd92b..f2a08ae769495e3cb8019f6b3a6bf95289d8d7e5 100755 GIT binary patch delta 1870 zcmZuyZ)jUp6u<9J()U8wv`JdiI&i zmzBJ&i(O00Es_o$4!?*N9du~XerOw6ohVch!7{|b#Kg8k8M?7{d;ZQ%vbL}bFTZ!r z?|09+=id8HZU>f{Mr-Bw9b^7O`$8IH^w=0iIb#w)_|mEt!qWgp5RbjU%fL41+rYJ@ z$L3ocJtd6w460hsAeW`LJh`>^?xy3bkB7ee;ri8qZRW9?<6rYL(u}JE8WpoEkR|}^ zo!~FZXA{8*RkJH(s+tX<+JGfU7$HQqc0%wSgqYt+h}Cu_SG4S>h%=C}Dj6F}u3MIM za<LL^_Mr3YLI4E5V`@nLu!ltw_ zFWDD_E%dcye+YZe>PxAs$!mXiMxT!bQD1EK6wfGu$6m&)W~wN8%YIb8k(tH>hQU>ef^8VeDlmN01=GjK`gDPbyNXdu)-vD3p5 zqb{Wy**EW6R?0LcAsWhq^9vSsIL%)%dy}WuY0ho+?21=y@TU`|F@+epb6Z8tarY)s zUbFnphAX`LeuCajf}Qsh>>WmZC`Sc~GX6^35p{f=uYXxtzxHEx#TMqwk!DJ@H* zxg2U9JuxE|yenP}At{iv93U-XJ1#=He6%2Gjz6?jlKQc6F7<6u)+uBO#&*XI#1Nsz zMW|HN*q)l7yS?LPKVAw^{e`GI9S!FvZIE<|oF>aG^SJ{j!Vr2$oA> zb&)j>3zs6u7;e+XIPk(AtGg>(iESCkyzasVtZW~8!w3#fskmC%XV$r-^~fKs^MhKW zTPp#uYAa;$_ z;Au_s5&da7G{Jw-k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_Wf7zx`)u~EZx^ptgdm9YK7N1>(VMQtH1kvwo`Lh zK5}V}(aaW9E`PRF%bz9ya8qbX$Ch}13d3ihWF~d|ahdFy%8$`A7;6_OVgcfoQRALjd(7U5+ z-<5cVmR|m+uFoYNIZm{Fe&6Etg%6J9UX4R|ZIg<26klrW!m6$>WzWyd&%p8qS>A&M zpB=`5=eO$5?T_7o;Y9Rh8=l&7K~Jkz-8Z7( zQh==h2LTSM{5U|0PmNv?;5fhrSQ?D{Yk<^J8rQ%~b7s2e_eNf5E;drjtTz$!HM5;J z0(8UTHt{xq?O3)0RK>PK0I9)rn)s*YQW@e0h*1+aTT11DY+eKLOU}q4i%IfPDwLjq zSx7KSgrtG~mM|zAk_P;P(4bsM8W;+MK?#vGFgpocXiCo!I^{$Q1IraUWt7nKNNi)2 zSHgh*6Aa2Kp;P~7j8aSJR6p?t=CC?tG}*n@-8RvXVU{sZi57422qE;LDyLN}%85y}~AC~_HT4`1V diff --git a/du4/program.c b/du4/program.c index b4daee9..ea1a107 100644 --- a/du4/program.c +++ b/du4/program.c @@ -1,14 +1,12 @@ #include -#include int main(){ - int c[2]; + int c[999]; int a, i = 0; int vysledok; char riadok[999]; char *endptr = NULL; - bool first = true; - bool second = false; + char need; while(1){ a++; char* r = fgets(riadok,999,stdin); @@ -17,38 +15,34 @@ int main(){ }else if(*r == ' ') continue; else if(*r == '+'){ - first = true; - second = true;; + need = *r; continue; }else if(*r == '-'){ - first = false; - second = false; + need = *r; continue; }else if(*r == '/'){ - first = true; - second = false; + need = *r; continue; }else if(*r == '*'){ - first = false; - second = true; + need = *r; continue; }else{ - float v = strtod(riadok,&endptr); + int v = strtod(riadok,&endptr); c[i++] = v; continue; } } - if(first == true && second == true) + if(need == '+') vysledok = c[0] + c[1]; - else if(first == false && second == false) + else if(need == '-') vysledok = c[0] - c[1]; - else if(first == true && second == false) + else if(need == '/') vysledok = c[0] / c[1]; - else if(first == false && second == true) + else if(need == '*') vysledok = c[0] * c[1]; - if(vysledok == c[2]) + if(vysledok == c[i]) printf("OK\n"); else printf("ZLE\n"); return 0; -} \ No newline at end of file +}