From c169f36d396f25041a7a2ca6858608ae722f06ea Mon Sep 17 00:00:00 2001 From: Yaroslav Orlianskyi Date: Wed, 30 Mar 2022 22:03:13 +0200 Subject: [PATCH] SAD --- du4/.program.c.swp | Bin 0 -> 12288 bytes du4/program | Bin 0 -> 5834 bytes du4/program.c | 54 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 du4/.program.c.swp create mode 100755 du4/program create mode 100644 du4/program.c diff --git a/du4/.program.c.swp b/du4/.program.c.swp new file mode 100644 index 0000000000000000000000000000000000000000..d382a85c579bfdc5a6206642bac35042bcfa2069 GIT binary patch literal 12288 zcmeI%ziPrz6vy$S*r9_c?F*#3)Fsgva4Fp#I_jP#q7n0_8ii8oQ~5X|eE@w1J+X?D zqafjX;Fo*Jx!mM_#^kfv?|v8^(-Ey|cKNTblE`=5cI;VrzIAns!@3~Oyl9y4NdQ|j2Qw5+(e+nc6dfo85I_I{1Q0*~0R#|0009IL$ccdKi>xXlYfbk5Kl=u-)A?5O zr`c$Zy_}qvV<3P40tg_000IagfB*srAdokKUwM=uN{!GBqSwZcNIi(W$=n|pZ?n`7 IVsrE^2dLvGR{#J2 literal 0 HcmV?d00001 diff --git a/du4/program b/du4/program new file mode 100755 index 0000000000000000000000000000000000000000..d183456d48a66c5f14091b6790923d65cee0421d GIT binary patch literal 5834 zcmb7I4Q!Lg89pb5x@~YmfG&lsSn$C@M@)b~S!p$#nD7^V3V~|<;foVHu~)~A?9V_t zs)aiIqyY&{Xltcvq7q|FLt3OU7IkP1gz__08bzoAF=^eFZplKmbfkc`74LcOeC9K> z(st78yXW5L?tSn5-n;MoeSdjdp6%1ZE8!ZyVZOwqaxpIE^Q4+(K$uhT`D3mrx4pMxIofuiT17mYN{ ziv}yBkyvVnHyQUXP-EemT-%Cuo8?&g$uS-X=bj8=iS#n`t$2IBfoO~b$iW} zr`OMa=@@lbRxXZmy}-I)NpkIQT^91S4eA)b&I)Nx+C9GJFa52X19U5|EVZFhwC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aGI9IPlH?~nbM-cJV>VrCqk&`+xni1#j(#c(n@*nmph-9W3unZ9 A8UO$Q literal 0 HcmV?d00001 diff --git a/du4/program.c b/du4/program.c new file mode 100644 index 0000000..27563ce --- /dev/null +++ b/du4/program.c @@ -0,0 +1,54 @@ +#include +#include + +int main(){ + int c[2]; + int a, i = 0; + int vysledok; + char riadok[999]; + char *endptr = NULL; + bool first = true; + bool second = false; + while(1){ + a++; + char* r = fgets(riadok,999,stdin); + if(*r == '\n'){ + break; + }else if(*r == ' ') + continue; + else if(*r == '+'){ + first = true; + second = true;; + continue; + }else if(*r == '-'){ + first = false; + second = false; + continue; + }else if(*r == '/'){ + first = true; + second = false; + continue; + }else if(*r == '*'){ + first = false; + second = true; + continue; + }else{ + float v = strtod(riadok,&endptr); + c[i++] = v; + continue; + } + } + if(first == true && second == true) + vysledok = c[0] + c[1]; + else if(first == false && second == false) + vysledok = c[0] - c[1]; + else if(first == true && second == false) + vysledok = c[0] / c[1]; + else if(first == false && second == true) + vysledok = c[0] * c[1]; + if(vysledok == c[2]) + printf("OK\n"); + else + printf("ZLE\n"); + return 0; +}