From ce16210809e790b829ca12f3991e3caff1bfc2ac Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Thu, 2 Apr 2020 23:29:32 +0000 Subject: [PATCH] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu4/program.c=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du4/program.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/du4/program.c b/du4/program.c index 35449d3..8286384 100644 --- a/du4/program.c +++ b/du4/program.c @@ -59,27 +59,30 @@ double compare_percent(double a, double b, double eps) int main() { - char str[100]; - memset(str,0,100); - fgets(str,100,stdin); - char *new_str = compactString(str,strlen(str)); - double first =-5,second =-5,res=-5; - char c='E'; - sscanf(new_str,"%lf%c%lf%*[=]%lf",&first,&c,&second,&res); - - - if(c=='E'||first==-5||second==-5||res==-5||(c!=43&&c!=42&&c!=45&&c!=47)){ - printf("CHYBA\n"); - return 0; - } - double my_res = operation(first,second,c); - if(compare_percent(res,my_res,0.01)==0){ - printf("OK\n"); - } - else{ - printf("ZLE\n"); + char str[100][100]; + int i =0; + for(;i<100;i++){ + scanf("%s",str[i]); } + for(int k=0;k