From 2af40bf26827986e038c549866980b25790d53b0 Mon Sep 17 00:00:00 2001 From: Nazar Sendetskyi Date: Tue, 14 Jun 2022 07:44:40 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D0=BB(=D0=B0)=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20'du4?= =?UTF-8?q?'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du4/program | Bin 0 -> 21176 bytes du4/program.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 du4/program create mode 100644 du4/program.c diff --git a/du4/program b/du4/program new file mode 100644 index 0000000000000000000000000000000000000000..bd51f49e7e290ae1eb2aabd84aec6f42d675116c GIT binary patch literal 21176 zcmeHP4|G&lnZIvlUh+bcnF)lDkXoh`Rw`x^{t7KAlaPT44Fw^zfQ83oW|E9dW`_CG z2Go+0qGVGvxN7m7+NHazb&u_e?k-}h-5}Lg*FRzRtkQKo;@TdQt*aQVi`sVf_uY5z z{CSzF+OucRo;|sc_ucPzzwf)>{qBA5-TU6$cg)+h*`g>+CM&z05$CBf5RWJr>=YRg z4_n8oaa_ulurlyAjv3`1gP_z%S1g586Sx(W^y(>7gx+AlOj79~QPL}wT0{ksGN&O) zdMafFZ>A?I3^_?Cc@jX9G+&Qm6K~?hEZ$m3&x*L56IALEOL{{>Z%F7# z%A~xYGM*F@`dcUBX{IieQF8GkV`jZQLeES)guJ9w2c=yvrGjs!z8yl(<>F?TnRXj6 zlT_CCPUulw{?H`5d8eqaR6mS~I7%wIlQl=eJ!@AtM}kd}a5O#GG`MbU)7sVUWX!#i zyFh+X9W3K~S^_^_ z0uPnIM@rzIFM+?e1pZdwF8rC(S^zFH2!0HI#oG0kz!w*hzZX~yTgaRqqfnkN4C7*e zhQV53s(mGu(PGBvwf4k(!DC1Tb<3Vbgw~!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NuFII6_ zRunKg$`YZ7pAS5dA?|lbm70 zI5P|lnMYOrfiR32>WDvclkS70KiY>=Sg_$}Z%pR>Jw1ugy^`arUm=AE zN?54RxR$&bfM#5{bmQJ>Bst%g)I9Sd+5B`f7<#uR_2s%iQdhn(@^}VWkk*3B*WV-7 z36d@;kfymyVd^yL%XNmNu0rt{`gfxoyD?(Y|FfcgNtX$IxrQ?P??*YFU1r-a*DaFL zs|iZfM#@TkJeTAtj3ZSk>zC^rNnbR?vPX0L52J+MJxYDK4w6*Pgr)ydPSX3KPwz4% zFV{b(N%7grKZn>dW>&EcDxjoLqlNI-aLbI%fUHfKg1O zeVQWhB&c~sVIDv9DlA{$CG;d66Xql_nP-oi^yRuwQYl|b|C~vGTqsC7Bozgf_9XqH zNng%)BwZr|X402t|G}g$*PD`7OF==+@%yUKm;KLNLQqi23N+h)lK&Pm6o0Ajav3F( zb{lN=Xs-YJD9P6!bQz+O?x4cFWC{m+31zfK6Q_N4JuJWTWtNw`q`!c!BTrwhn+KZ! zB1t)e%kdI_4FxoIW&Lt}Ex+3)14HK@C8;O-|1-d-iCO)PB*oZ}nD7p9E_aanlG6Gp zU!Qq|Y>Po>GM}er%VbamTfAb{|en0k^V#m)?jD&O7Gjr zrn#Msw;BrlCG@2q`%2V5EWVFrwk!37JG^dr?n;d41)+aN4BVT6t;U}mKl1ut0nFqg f5bW{ra>AZA88_EY%e!Lwl|DmX-hT~lW?%m|driA_ literal 0 HcmV?d00001 diff --git a/du4/program.c b/du4/program.c new file mode 100644 index 0000000..dcba597 --- /dev/null +++ b/du4/program.c @@ -0,0 +1,140 @@ +#include +#include +#include +#include +#include + +struct priklad//vytvorenie štruktúry, typu, v ktorom existujú iné typy +{ + double one; + char znak; + double two; + double sum; +}; + +int sort(struct priklad prik[20]); +void printAll(struct priklad prik[20], int i); + +int main(){ + +struct priklad prik[20]; +int i = sort(prik); + +printAll(prik,i); + + return 0; +} +void printAll(struct priklad prik[20], int i){ + for (size_t j = 0; j < i; j++) +{ +if( prik[j].one == 0 && prik[j].two == 0 &&prik[j].sum == 0){ + printf("CHYBA\n"); + continue; +} + if(prik[j].znak == '+'){ + // printf("%f", prik[j].one + prik[j].two); + if (round((prik[j].one + prik[j].two)*100)/100 == prik[j].sum)// round-zaokrúhli číslo + { + printf("OK\n"); + } else + { + printf("ZLE\n"); + } + + } + if(prik[j].znak == '-'){ + if (round((prik[j].one - prik[j].two)*100)/100 == prik[j].sum) + { + printf("OK\n"); + } else + { + printf("ZLE\n"); + } + + } + if(prik[j].znak == '*'){ + if (round(prik[j].one * prik[j].two * 100) / 100 == prik[j].sum) + { + printf("OK\n"); + } else + { + printf("ZLE\n"); + } + + } + if(prik[j].znak == '/'){ + if (round(prik[j].one / prik[j].two * 100) / 100 == prik[j].sum) + { + printf("OK\n"); + } else + { + printf("ZLE\n"); + } + + } + +} +} + +int sort(struct priklad prik[20]){ +int i = 0; + while (1) + { + char step_line[30]; + char step_one[5]; + memset(step_one,' ',5);//vyplnenie štandardnými hodnotami poľa + char step_two[10]; + memset(step_two,' ',10); + char step_sum[10]; + memset(step_sum,' ',10); + char* r = fgets(step_line,30,stdin); //číta koncový znak + if (r == NULL){ + break; + } + int k = 0; + while (step_line[k] != ' ') + { + step_one[k] = step_line[k]; + k++; + } + k++; + prik[i].znak = step_line[k]; + k = k+2; + int j = 0; + while (step_line[k]!= ' ') + { + step_two[j] = step_line[k]; + k++; + j++; + } + + + k = k+3; + int p = 0; + while (k