From 37145fb7dbb038b2a2383586ba59255452063a2f Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Thu, 2 Apr 2020 23:56:53 +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 | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/du4/program.c b/du4/program.c index 8b4609e..dcc844c 100644 --- a/du4/program.c +++ b/du4/program.c @@ -52,19 +52,9 @@ double compare_percent(double a, double b, double eps) int main() { char str[100][100]; - int i =0; - int j =0; char b ; - while((b=getchar())!=EOF){ - if(b=='\n'){ - j=0; - i++; - } - str[i][j]=b; - j++; - } - for(int k=0;k<=i-1;k++){ - char *new_str = compactString(str[k],strlen(str[k])); + for(int i =0;fgets(str[i],100,stdin);i++){ + char *new_str = compactString(str[i],strlen(str[i])); double first =-5,second =-5,res=-5; char c='E'; sscanf(new_str,"%lf%c%lf%*[=]%lf",&first,&c,&second,&res); @@ -82,6 +72,6 @@ int main() printf("ZLE\n"); } - } +} return 0; } \ No newline at end of file