From 6bc162f509ca458aad017ed2a8fefff90636f516 Mon Sep 17 00:00:00 2001 From: Yurii Yakovenko Date: Tue, 1 Oct 2024 19:27:56 +0000 Subject: [PATCH] Update cv1/program.c --- cv1/program.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index d467b38..3038ce9 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -42,31 +42,30 @@ int main() int count =0; printf("Zadaj hladanu surovinu:\n"); scanf("%s", pizz); - + + printf("Zadaj␣jedalny␣listok:\n"); while(1) { - printf("Zadaj␣jedalny␣listok:\n"); + do { p=fgets(r, 299, stdin); - } - - while(p!=NULL && p[0]=='\n'); + }while(p!=NULL && p[0]=='\n'); + + if(p==NULL) { - if(p==NULL) - { - break; - } - if(scanf("%f", &price)!=1) - { - break; - } - if(check(r, pizz)) - { - count++; - printf("%s %.2f\n", r, price); - } + break; } + if(scanf("%f", &price)!=1) + { + break; + } + if(check(r, pizz)) + { + count++; + printf("%s %.2f\n", r, price); + } + } printf("Nacitanyh %d poloziek", count);