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