From bef7e19ebe3a95e3ccd102a3178dfc90dd872aa3 Mon Sep 17 00:00:00 2001 From: Vladyslav Korzun Date: Thu, 23 Mar 2023 17:50:53 +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'a1/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- a1/program.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/a1/program.c b/a1/program.c index a24d37e..566e251 100644 --- a/a1/program.c +++ b/a1/program.c @@ -16,6 +16,7 @@ int main() { char* zaciatok_cisla = znaky; int cislo = 0; int counter = 0; + int che = 0; while ((r = fgets(znaky, LINE_SIZE, stdin)) != NULL) { if (feof(stdin)) { break; @@ -43,7 +44,7 @@ int main() { } if(counter != 3){ printf("Neplatny datum.\n"); - break; + che = 1; } //printf("%d %d %d\n", dd, mm, yyyy); time_t t = time(NULL); @@ -68,12 +69,14 @@ int main() { if(buffer[3] == 48){ buffer[3] = '&'; } + if(che == 0){ for(int i = 0; i < 10; i++){ if(buffer[i] != '&'){ printf("%c", buffer[i]); } - } printf("\n\n"); } + } + } return 0; }