From 574623a4fd25eabe4e12c5b5e83dcfba55011e19 Mon Sep 17 00:00:00 2001 From: Vladyslav Korzun Date: Wed, 8 Mar 2023 14:57:24 +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'du4/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du4/program.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/du4/program.c b/du4/program.c index ac38d82..63b3799 100644 --- a/du4/program.c +++ b/du4/program.c @@ -20,6 +20,7 @@ int main() { float b = 0; float c = 1; int counter = 0; + int counter2 = 0; float sr= 0; int p = 0; int check = 0; @@ -34,6 +35,7 @@ int main() { sym++; } if(znaky[i] == '-'){ + counter2 = 5; if(znaky[i - 1] == ' ' && znaky[i + 1] == ' '){ symbol[sym] = znaky[i]; znaky[i] = ' '; @@ -69,13 +71,19 @@ int main() { if(symbol[j] == '=') p = j; } - //printf("%d", sym); + //printf("--->>%d", sym); if(sym == 1){ + if(counter2 == 5){ //printf("a--->>%f\n", a); //printf("b--->>%f\n", b); b = b * -1; sr = a - b; //printf("%f", sr); + } + else{ + printf("CHYBA\n"); + check = 1; + } } else{ if(symbol[p - 1] == '+'){ @@ -106,6 +114,7 @@ int main() { } check = 0; sym = 0; + counter = 0; } if (feof(stdin)) { //printf("Dostal som sa na koniec suboru\n");