From a7a72ded64221b6a05d9180b56b1aa7c1990cc00 Mon Sep 17 00:00:00 2001 From: Vladyslav Korzun Date: Thu, 2 Mar 2023 10:36:56 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'du3/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/du3/program.c b/du3/program.c index 95b98fb..4c6fbfb 100644 --- a/du3/program.c +++ b/du3/program.c @@ -8,6 +8,8 @@ #include +#include + #define LINE_SIZE 150 int main(){ @@ -34,11 +36,17 @@ int main(){ float h = 0; + //float p = 0; + while(stop == 0){ r = fgets(riadok,LINE_SIZE,stdin); - assert(r!=NULL); + if (r == NULL || !isdigit(*r)) { + + break; + + } r2 = atof(riadok); @@ -48,14 +56,6 @@ int main(){ i++; - if (r2 == 0){ - - //printf("Konverzia sa nepodarila alebo v reťazci sa nachádza nula.\n"); - - stop++; - - } - } x = mass[0]; @@ -68,13 +68,13 @@ int main(){ h = mass[j]; - //printf("h>>> %1.f\n", h); + printf("h>>> %1.f\n", h); if(counter == -1){ vysl = x * h + mass[j + 1]; - //printf("vysl>>> %1.f\n", vysl); + printf("vysl>>> %1.f\n", vysl); counter++; @@ -86,7 +86,7 @@ int main(){ vysl = x * vysl + mass[j + 1]; - //printf("vysl22>>>>> %1.f\n", vysl); + printf("vysl22>>>>> %1.f\n", vysl); }