From 1c091739bd882b030ec9555de0559f6bdc7f6bcb Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 12:47:27 +0000 Subject: [PATCH 01/16] Add 'du4' --- du4 | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 du4 diff --git a/du4 b/du4 new file mode 100644 index 0000000..ea71802 --- /dev/null +++ b/du4 @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +char array[100]; +char array1[100]; +char number1[100]; +char number2[100]; +char answer[100]; +int p=0; +float zero=0; +char znak1; +char znak2; +float firstN=0; +float secondN=0; +float answer1=0; +float myAnswer=0; +char c; +char r; +char q; +int count = 0; +int scan(char* array2){ +char* r = fgets(array1,100,stdin); +if (r == NULL){ + return -1; +} + else{ + return 0; + } +} +int main(){ +scan(array1); +int i=0; +while(i<100){ + i=i+1; + if(array1[i]!='\n'){ + count=count+1; + } + if(array1[i]=='\n'){ + if(array1[i+1]=='\n') + { + array1[i]='#'; + break; + } + } + else + { + count=count+1; + } +} +i=0; +int j=0; +int t=0; +while(array1[t]!='#'){ + array[p]=array1[t]; + if(array1[t]=='='){ + t=t+1; + p=p+1; + if(array1[t]==' '){ + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array1[t]!=' ') + { + if(array1[t]=='#'){ + break; + } + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array[i]!='\0'){ + if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ + break; + } + else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number1[j]= array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' ' || isalpha(array[i])){i++;} + else{ + printf("CHYBA\n"); + return 0; + } + } + znak1=array[i]; + i=i+1; + j=0; + while(array[i]!='='){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number2[j]=array[i]; + j=j+1; + i=i+1; + } + else if(array[i]==' '){ + i=i+1; + } + else{ + i=i+1; + p=p+1; + } +} + znak2=array[i]; + i++; + j=0; + j=0; +while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + answer[j]=array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' '){ + i=i+1; + }else{ + i=i+1; + p=p+1; + } + } + j=0; + float firstN = atof(number1); + float secondN = atof(number2); + float answer1 = atof(answer); + if(znak1=='-'){ + myAnswer=firstN-secondN; + } + else if(znak1=='+'){ + myAnswer=firstN+secondN; + } + else if(znak1=='/'){ + myAnswer=firstN/secondN; + } + else if(znak1=='*'){ + myAnswer=firstN*secondN; + } + zero = myAnswer-answer1; + if(zero>=-0.00001&&zero<=0.00001){ + printf("OK\n"); + } + else{ + printf("ZLE\n"); + } + i=0; + p=-1; + memset(array,0,100); + } + p=p+1; + t=t+1; + scanf("\n%c",&q); + if(c=='\n'){ + return 0; + } +} + return 0; +} \ No newline at end of file From b3cb07545ed3f689e79c92ef6a8f665000aac4b0 Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 12:52:15 +0000 Subject: [PATCH 02/16] Delete 'du4' --- du4 | 158 ------------------------------------------------------------ 1 file changed, 158 deletions(-) delete mode 100644 du4 diff --git a/du4 b/du4 deleted file mode 100644 index ea71802..0000000 --- a/du4 +++ /dev/null @@ -1,158 +0,0 @@ -#include -#include -#include -#include -#include -char array[100]; -char array1[100]; -char number1[100]; -char number2[100]; -char answer[100]; -int p=0; -float zero=0; -char znak1; -char znak2; -float firstN=0; -float secondN=0; -float answer1=0; -float myAnswer=0; -char c; -char r; -char q; -int count = 0; -int scan(char* array2){ -char* r = fgets(array1,100,stdin); -if (r == NULL){ - return -1; -} - else{ - return 0; - } -} -int main(){ -scan(array1); -int i=0; -while(i<100){ - i=i+1; - if(array1[i]!='\n'){ - count=count+1; - } - if(array1[i]=='\n'){ - if(array1[i+1]=='\n') - { - array1[i]='#'; - break; - } - } - else - { - count=count+1; - } -} -i=0; -int j=0; -int t=0; -while(array1[t]!='#'){ - array[p]=array1[t]; - if(array1[t]=='='){ - t=t+1; - p=p+1; - if(array1[t]==' '){ - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array1[t]!=' ') - { - if(array1[t]=='#'){ - break; - } - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array[i]!='\0'){ - if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ - break; - } - else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number1[j]= array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' ' || isalpha(array[i])){i++;} - else{ - printf("CHYBA\n"); - return 0; - } - } - znak1=array[i]; - i=i+1; - j=0; - while(array[i]!='='){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number2[j]=array[i]; - j=j+1; - i=i+1; - } - else if(array[i]==' '){ - i=i+1; - } - else{ - i=i+1; - p=p+1; - } -} - znak2=array[i]; - i++; - j=0; - j=0; -while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - answer[j]=array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' '){ - i=i+1; - }else{ - i=i+1; - p=p+1; - } - } - j=0; - float firstN = atof(number1); - float secondN = atof(number2); - float answer1 = atof(answer); - if(znak1=='-'){ - myAnswer=firstN-secondN; - } - else if(znak1=='+'){ - myAnswer=firstN+secondN; - } - else if(znak1=='/'){ - myAnswer=firstN/secondN; - } - else if(znak1=='*'){ - myAnswer=firstN*secondN; - } - zero = myAnswer-answer1; - if(zero>=-0.00001&&zero<=0.00001){ - printf("OK\n"); - } - else{ - printf("ZLE\n"); - } - i=0; - p=-1; - memset(array,0,100); - } - p=p+1; - t=t+1; - scanf("\n%c",&q); - if(c=='\n'){ - return 0; - } -} - return 0; -} \ No newline at end of file From b310e78ec4c89449f1fca329285b235120a9b985 Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 12:52:36 +0000 Subject: [PATCH 03/16] Upload files to 'du4' --- du4/du4.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 du4/du4.c diff --git a/du4/du4.c b/du4/du4.c new file mode 100644 index 0000000..ea71802 --- /dev/null +++ b/du4/du4.c @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +char array[100]; +char array1[100]; +char number1[100]; +char number2[100]; +char answer[100]; +int p=0; +float zero=0; +char znak1; +char znak2; +float firstN=0; +float secondN=0; +float answer1=0; +float myAnswer=0; +char c; +char r; +char q; +int count = 0; +int scan(char* array2){ +char* r = fgets(array1,100,stdin); +if (r == NULL){ + return -1; +} + else{ + return 0; + } +} +int main(){ +scan(array1); +int i=0; +while(i<100){ + i=i+1; + if(array1[i]!='\n'){ + count=count+1; + } + if(array1[i]=='\n'){ + if(array1[i+1]=='\n') + { + array1[i]='#'; + break; + } + } + else + { + count=count+1; + } +} +i=0; +int j=0; +int t=0; +while(array1[t]!='#'){ + array[p]=array1[t]; + if(array1[t]=='='){ + t=t+1; + p=p+1; + if(array1[t]==' '){ + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array1[t]!=' ') + { + if(array1[t]=='#'){ + break; + } + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array[i]!='\0'){ + if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ + break; + } + else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number1[j]= array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' ' || isalpha(array[i])){i++;} + else{ + printf("CHYBA\n"); + return 0; + } + } + znak1=array[i]; + i=i+1; + j=0; + while(array[i]!='='){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number2[j]=array[i]; + j=j+1; + i=i+1; + } + else if(array[i]==' '){ + i=i+1; + } + else{ + i=i+1; + p=p+1; + } +} + znak2=array[i]; + i++; + j=0; + j=0; +while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + answer[j]=array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' '){ + i=i+1; + }else{ + i=i+1; + p=p+1; + } + } + j=0; + float firstN = atof(number1); + float secondN = atof(number2); + float answer1 = atof(answer); + if(znak1=='-'){ + myAnswer=firstN-secondN; + } + else if(znak1=='+'){ + myAnswer=firstN+secondN; + } + else if(znak1=='/'){ + myAnswer=firstN/secondN; + } + else if(znak1=='*'){ + myAnswer=firstN*secondN; + } + zero = myAnswer-answer1; + if(zero>=-0.00001&&zero<=0.00001){ + printf("OK\n"); + } + else{ + printf("ZLE\n"); + } + i=0; + p=-1; + memset(array,0,100); + } + p=p+1; + t=t+1; + scanf("\n%c",&q); + if(c=='\n'){ + return 0; + } +} + return 0; +} \ No newline at end of file From 7bd15b6a39044ea9d5e9ddea36bd261a0c19363e Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 12:53:15 +0000 Subject: [PATCH 04/16] Update 'program.c' --- du4/du4.c => program.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename du4/du4.c => program.c (100%) diff --git a/du4/du4.c b/program.c similarity index 100% rename from du4/du4.c rename to program.c From c4f58fea6334aca208dfc50c62fa3a5df7427c50 Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 12:53:44 +0000 Subject: [PATCH 05/16] Delete 'program.c' --- program.c | 158 ------------------------------------------------------ 1 file changed, 158 deletions(-) delete mode 100644 program.c diff --git a/program.c b/program.c deleted file mode 100644 index ea71802..0000000 --- a/program.c +++ /dev/null @@ -1,158 +0,0 @@ -#include -#include -#include -#include -#include -char array[100]; -char array1[100]; -char number1[100]; -char number2[100]; -char answer[100]; -int p=0; -float zero=0; -char znak1; -char znak2; -float firstN=0; -float secondN=0; -float answer1=0; -float myAnswer=0; -char c; -char r; -char q; -int count = 0; -int scan(char* array2){ -char* r = fgets(array1,100,stdin); -if (r == NULL){ - return -1; -} - else{ - return 0; - } -} -int main(){ -scan(array1); -int i=0; -while(i<100){ - i=i+1; - if(array1[i]!='\n'){ - count=count+1; - } - if(array1[i]=='\n'){ - if(array1[i+1]=='\n') - { - array1[i]='#'; - break; - } - } - else - { - count=count+1; - } -} -i=0; -int j=0; -int t=0; -while(array1[t]!='#'){ - array[p]=array1[t]; - if(array1[t]=='='){ - t=t+1; - p=p+1; - if(array1[t]==' '){ - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array1[t]!=' ') - { - if(array1[t]=='#'){ - break; - } - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array[i]!='\0'){ - if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ - break; - } - else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number1[j]= array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' ' || isalpha(array[i])){i++;} - else{ - printf("CHYBA\n"); - return 0; - } - } - znak1=array[i]; - i=i+1; - j=0; - while(array[i]!='='){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number2[j]=array[i]; - j=j+1; - i=i+1; - } - else if(array[i]==' '){ - i=i+1; - } - else{ - i=i+1; - p=p+1; - } -} - znak2=array[i]; - i++; - j=0; - j=0; -while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - answer[j]=array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' '){ - i=i+1; - }else{ - i=i+1; - p=p+1; - } - } - j=0; - float firstN = atof(number1); - float secondN = atof(number2); - float answer1 = atof(answer); - if(znak1=='-'){ - myAnswer=firstN-secondN; - } - else if(znak1=='+'){ - myAnswer=firstN+secondN; - } - else if(znak1=='/'){ - myAnswer=firstN/secondN; - } - else if(znak1=='*'){ - myAnswer=firstN*secondN; - } - zero = myAnswer-answer1; - if(zero>=-0.00001&&zero<=0.00001){ - printf("OK\n"); - } - else{ - printf("ZLE\n"); - } - i=0; - p=-1; - memset(array,0,100); - } - p=p+1; - t=t+1; - scanf("\n%c",&q); - if(c=='\n'){ - return 0; - } -} - return 0; -} \ No newline at end of file From a6dc92293b31e8f8172d97a3a71a842bb4a0ec4d Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 12:54:06 +0000 Subject: [PATCH 06/16] Upload files to 'du4' --- du4/du4.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 du4/du4.c diff --git a/du4/du4.c b/du4/du4.c new file mode 100644 index 0000000..ea71802 --- /dev/null +++ b/du4/du4.c @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +char array[100]; +char array1[100]; +char number1[100]; +char number2[100]; +char answer[100]; +int p=0; +float zero=0; +char znak1; +char znak2; +float firstN=0; +float secondN=0; +float answer1=0; +float myAnswer=0; +char c; +char r; +char q; +int count = 0; +int scan(char* array2){ +char* r = fgets(array1,100,stdin); +if (r == NULL){ + return -1; +} + else{ + return 0; + } +} +int main(){ +scan(array1); +int i=0; +while(i<100){ + i=i+1; + if(array1[i]!='\n'){ + count=count+1; + } + if(array1[i]=='\n'){ + if(array1[i+1]=='\n') + { + array1[i]='#'; + break; + } + } + else + { + count=count+1; + } +} +i=0; +int j=0; +int t=0; +while(array1[t]!='#'){ + array[p]=array1[t]; + if(array1[t]=='='){ + t=t+1; + p=p+1; + if(array1[t]==' '){ + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array1[t]!=' ') + { + if(array1[t]=='#'){ + break; + } + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array[i]!='\0'){ + if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ + break; + } + else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number1[j]= array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' ' || isalpha(array[i])){i++;} + else{ + printf("CHYBA\n"); + return 0; + } + } + znak1=array[i]; + i=i+1; + j=0; + while(array[i]!='='){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number2[j]=array[i]; + j=j+1; + i=i+1; + } + else if(array[i]==' '){ + i=i+1; + } + else{ + i=i+1; + p=p+1; + } +} + znak2=array[i]; + i++; + j=0; + j=0; +while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + answer[j]=array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' '){ + i=i+1; + }else{ + i=i+1; + p=p+1; + } + } + j=0; + float firstN = atof(number1); + float secondN = atof(number2); + float answer1 = atof(answer); + if(znak1=='-'){ + myAnswer=firstN-secondN; + } + else if(znak1=='+'){ + myAnswer=firstN+secondN; + } + else if(znak1=='/'){ + myAnswer=firstN/secondN; + } + else if(znak1=='*'){ + myAnswer=firstN*secondN; + } + zero = myAnswer-answer1; + if(zero>=-0.00001&&zero<=0.00001){ + printf("OK\n"); + } + else{ + printf("ZLE\n"); + } + i=0; + p=-1; + memset(array,0,100); + } + p=p+1; + t=t+1; + scanf("\n%c",&q); + if(c=='\n'){ + return 0; + } +} + return 0; +} \ No newline at end of file From a828b2183a04acda7b84d0b52921a869c727fa9e Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 12:55:05 +0000 Subject: [PATCH 07/16] Delete 'du4/du4.c' --- du4/du4.c | 158 ------------------------------------------------------ 1 file changed, 158 deletions(-) delete mode 100644 du4/du4.c diff --git a/du4/du4.c b/du4/du4.c deleted file mode 100644 index ea71802..0000000 --- a/du4/du4.c +++ /dev/null @@ -1,158 +0,0 @@ -#include -#include -#include -#include -#include -char array[100]; -char array1[100]; -char number1[100]; -char number2[100]; -char answer[100]; -int p=0; -float zero=0; -char znak1; -char znak2; -float firstN=0; -float secondN=0; -float answer1=0; -float myAnswer=0; -char c; -char r; -char q; -int count = 0; -int scan(char* array2){ -char* r = fgets(array1,100,stdin); -if (r == NULL){ - return -1; -} - else{ - return 0; - } -} -int main(){ -scan(array1); -int i=0; -while(i<100){ - i=i+1; - if(array1[i]!='\n'){ - count=count+1; - } - if(array1[i]=='\n'){ - if(array1[i+1]=='\n') - { - array1[i]='#'; - break; - } - } - else - { - count=count+1; - } -} -i=0; -int j=0; -int t=0; -while(array1[t]!='#'){ - array[p]=array1[t]; - if(array1[t]=='='){ - t=t+1; - p=p+1; - if(array1[t]==' '){ - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array1[t]!=' ') - { - if(array1[t]=='#'){ - break; - } - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array[i]!='\0'){ - if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ - break; - } - else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number1[j]= array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' ' || isalpha(array[i])){i++;} - else{ - printf("CHYBA\n"); - return 0; - } - } - znak1=array[i]; - i=i+1; - j=0; - while(array[i]!='='){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number2[j]=array[i]; - j=j+1; - i=i+1; - } - else if(array[i]==' '){ - i=i+1; - } - else{ - i=i+1; - p=p+1; - } -} - znak2=array[i]; - i++; - j=0; - j=0; -while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - answer[j]=array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' '){ - i=i+1; - }else{ - i=i+1; - p=p+1; - } - } - j=0; - float firstN = atof(number1); - float secondN = atof(number2); - float answer1 = atof(answer); - if(znak1=='-'){ - myAnswer=firstN-secondN; - } - else if(znak1=='+'){ - myAnswer=firstN+secondN; - } - else if(znak1=='/'){ - myAnswer=firstN/secondN; - } - else if(znak1=='*'){ - myAnswer=firstN*secondN; - } - zero = myAnswer-answer1; - if(zero>=-0.00001&&zero<=0.00001){ - printf("OK\n"); - } - else{ - printf("ZLE\n"); - } - i=0; - p=-1; - memset(array,0,100); - } - p=p+1; - t=t+1; - scanf("\n%c",&q); - if(c=='\n'){ - return 0; - } -} - return 0; -} \ No newline at end of file From 2faafc6c29daa89da30e2b03d2d0f3ad94fa5263 Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 12:55:21 +0000 Subject: [PATCH 08/16] Upload files to 'du4' --- du4/program.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 du4/program.c diff --git a/du4/program.c b/du4/program.c new file mode 100644 index 0000000..ea71802 --- /dev/null +++ b/du4/program.c @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +char array[100]; +char array1[100]; +char number1[100]; +char number2[100]; +char answer[100]; +int p=0; +float zero=0; +char znak1; +char znak2; +float firstN=0; +float secondN=0; +float answer1=0; +float myAnswer=0; +char c; +char r; +char q; +int count = 0; +int scan(char* array2){ +char* r = fgets(array1,100,stdin); +if (r == NULL){ + return -1; +} + else{ + return 0; + } +} +int main(){ +scan(array1); +int i=0; +while(i<100){ + i=i+1; + if(array1[i]!='\n'){ + count=count+1; + } + if(array1[i]=='\n'){ + if(array1[i+1]=='\n') + { + array1[i]='#'; + break; + } + } + else + { + count=count+1; + } +} +i=0; +int j=0; +int t=0; +while(array1[t]!='#'){ + array[p]=array1[t]; + if(array1[t]=='='){ + t=t+1; + p=p+1; + if(array1[t]==' '){ + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array1[t]!=' ') + { + if(array1[t]=='#'){ + break; + } + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array[i]!='\0'){ + if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ + break; + } + else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number1[j]= array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' ' || isalpha(array[i])){i++;} + else{ + printf("CHYBA\n"); + return 0; + } + } + znak1=array[i]; + i=i+1; + j=0; + while(array[i]!='='){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number2[j]=array[i]; + j=j+1; + i=i+1; + } + else if(array[i]==' '){ + i=i+1; + } + else{ + i=i+1; + p=p+1; + } +} + znak2=array[i]; + i++; + j=0; + j=0; +while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + answer[j]=array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' '){ + i=i+1; + }else{ + i=i+1; + p=p+1; + } + } + j=0; + float firstN = atof(number1); + float secondN = atof(number2); + float answer1 = atof(answer); + if(znak1=='-'){ + myAnswer=firstN-secondN; + } + else if(znak1=='+'){ + myAnswer=firstN+secondN; + } + else if(znak1=='/'){ + myAnswer=firstN/secondN; + } + else if(znak1=='*'){ + myAnswer=firstN*secondN; + } + zero = myAnswer-answer1; + if(zero>=-0.00001&&zero<=0.00001){ + printf("OK\n"); + } + else{ + printf("ZLE\n"); + } + i=0; + p=-1; + memset(array,0,100); + } + p=p+1; + t=t+1; + scanf("\n%c",&q); + if(c=='\n'){ + return 0; + } +} + return 0; +} \ No newline at end of file From b438c121f760a5f164a5b19fafa6feadc5345a7a Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 13:00:16 +0000 Subject: [PATCH 09/16] Delete 'du4/program.c' --- du4/program.c | 158 -------------------------------------------------- 1 file changed, 158 deletions(-) delete mode 100644 du4/program.c diff --git a/du4/program.c b/du4/program.c deleted file mode 100644 index ea71802..0000000 --- a/du4/program.c +++ /dev/null @@ -1,158 +0,0 @@ -#include -#include -#include -#include -#include -char array[100]; -char array1[100]; -char number1[100]; -char number2[100]; -char answer[100]; -int p=0; -float zero=0; -char znak1; -char znak2; -float firstN=0; -float secondN=0; -float answer1=0; -float myAnswer=0; -char c; -char r; -char q; -int count = 0; -int scan(char* array2){ -char* r = fgets(array1,100,stdin); -if (r == NULL){ - return -1; -} - else{ - return 0; - } -} -int main(){ -scan(array1); -int i=0; -while(i<100){ - i=i+1; - if(array1[i]!='\n'){ - count=count+1; - } - if(array1[i]=='\n'){ - if(array1[i+1]=='\n') - { - array1[i]='#'; - break; - } - } - else - { - count=count+1; - } -} -i=0; -int j=0; -int t=0; -while(array1[t]!='#'){ - array[p]=array1[t]; - if(array1[t]=='='){ - t=t+1; - p=p+1; - if(array1[t]==' '){ - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array1[t]!=' ') - { - if(array1[t]=='#'){ - break; - } - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array[i]!='\0'){ - if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ - break; - } - else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number1[j]= array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' ' || isalpha(array[i])){i++;} - else{ - printf("CHYBA\n"); - return 0; - } - } - znak1=array[i]; - i=i+1; - j=0; - while(array[i]!='='){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number2[j]=array[i]; - j=j+1; - i=i+1; - } - else if(array[i]==' '){ - i=i+1; - } - else{ - i=i+1; - p=p+1; - } -} - znak2=array[i]; - i++; - j=0; - j=0; -while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - answer[j]=array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' '){ - i=i+1; - }else{ - i=i+1; - p=p+1; - } - } - j=0; - float firstN = atof(number1); - float secondN = atof(number2); - float answer1 = atof(answer); - if(znak1=='-'){ - myAnswer=firstN-secondN; - } - else if(znak1=='+'){ - myAnswer=firstN+secondN; - } - else if(znak1=='/'){ - myAnswer=firstN/secondN; - } - else if(znak1=='*'){ - myAnswer=firstN*secondN; - } - zero = myAnswer-answer1; - if(zero>=-0.00001&&zero<=0.00001){ - printf("OK\n"); - } - else{ - printf("ZLE\n"); - } - i=0; - p=-1; - memset(array,0,100); - } - p=p+1; - t=t+1; - scanf("\n%c",&q); - if(c=='\n'){ - return 0; - } -} - return 0; -} \ No newline at end of file From 086a7feb0a03d86f70e28040bdd42d1d9d7348db Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 13:00:49 +0000 Subject: [PATCH 10/16] Upload files to 'du4' --- du4/program.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 du4/program.c diff --git a/du4/program.c b/du4/program.c new file mode 100644 index 0000000..ea71802 --- /dev/null +++ b/du4/program.c @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +char array[100]; +char array1[100]; +char number1[100]; +char number2[100]; +char answer[100]; +int p=0; +float zero=0; +char znak1; +char znak2; +float firstN=0; +float secondN=0; +float answer1=0; +float myAnswer=0; +char c; +char r; +char q; +int count = 0; +int scan(char* array2){ +char* r = fgets(array1,100,stdin); +if (r == NULL){ + return -1; +} + else{ + return 0; + } +} +int main(){ +scan(array1); +int i=0; +while(i<100){ + i=i+1; + if(array1[i]!='\n'){ + count=count+1; + } + if(array1[i]=='\n'){ + if(array1[i+1]=='\n') + { + array1[i]='#'; + break; + } + } + else + { + count=count+1; + } +} +i=0; +int j=0; +int t=0; +while(array1[t]!='#'){ + array[p]=array1[t]; + if(array1[t]=='='){ + t=t+1; + p=p+1; + if(array1[t]==' '){ + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array1[t]!=' ') + { + if(array1[t]=='#'){ + break; + } + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array[i]!='\0'){ + if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ + break; + } + else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number1[j]= array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' ' || isalpha(array[i])){i++;} + else{ + printf("CHYBA\n"); + return 0; + } + } + znak1=array[i]; + i=i+1; + j=0; + while(array[i]!='='){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number2[j]=array[i]; + j=j+1; + i=i+1; + } + else if(array[i]==' '){ + i=i+1; + } + else{ + i=i+1; + p=p+1; + } +} + znak2=array[i]; + i++; + j=0; + j=0; +while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + answer[j]=array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' '){ + i=i+1; + }else{ + i=i+1; + p=p+1; + } + } + j=0; + float firstN = atof(number1); + float secondN = atof(number2); + float answer1 = atof(answer); + if(znak1=='-'){ + myAnswer=firstN-secondN; + } + else if(znak1=='+'){ + myAnswer=firstN+secondN; + } + else if(znak1=='/'){ + myAnswer=firstN/secondN; + } + else if(znak1=='*'){ + myAnswer=firstN*secondN; + } + zero = myAnswer-answer1; + if(zero>=-0.00001&&zero<=0.00001){ + printf("OK\n"); + } + else{ + printf("ZLE\n"); + } + i=0; + p=-1; + memset(array,0,100); + } + p=p+1; + t=t+1; + scanf("\n%c",&q); + if(c=='\n'){ + return 0; + } +} + return 0; +} \ No newline at end of file From 535d3167758ad157040977105b42628afcdd3abe Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 13:02:04 +0000 Subject: [PATCH 11/16] Delete 'du4/program.c' --- du4/program.c | 158 -------------------------------------------------- 1 file changed, 158 deletions(-) delete mode 100644 du4/program.c diff --git a/du4/program.c b/du4/program.c deleted file mode 100644 index ea71802..0000000 --- a/du4/program.c +++ /dev/null @@ -1,158 +0,0 @@ -#include -#include -#include -#include -#include -char array[100]; -char array1[100]; -char number1[100]; -char number2[100]; -char answer[100]; -int p=0; -float zero=0; -char znak1; -char znak2; -float firstN=0; -float secondN=0; -float answer1=0; -float myAnswer=0; -char c; -char r; -char q; -int count = 0; -int scan(char* array2){ -char* r = fgets(array1,100,stdin); -if (r == NULL){ - return -1; -} - else{ - return 0; - } -} -int main(){ -scan(array1); -int i=0; -while(i<100){ - i=i+1; - if(array1[i]!='\n'){ - count=count+1; - } - if(array1[i]=='\n'){ - if(array1[i+1]=='\n') - { - array1[i]='#'; - break; - } - } - else - { - count=count+1; - } -} -i=0; -int j=0; -int t=0; -while(array1[t]!='#'){ - array[p]=array1[t]; - if(array1[t]=='='){ - t=t+1; - p=p+1; - if(array1[t]==' '){ - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array1[t]!=' ') - { - if(array1[t]=='#'){ - break; - } - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array[i]!='\0'){ - if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ - break; - } - else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number1[j]= array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' ' || isalpha(array[i])){i++;} - else{ - printf("CHYBA\n"); - return 0; - } - } - znak1=array[i]; - i=i+1; - j=0; - while(array[i]!='='){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number2[j]=array[i]; - j=j+1; - i=i+1; - } - else if(array[i]==' '){ - i=i+1; - } - else{ - i=i+1; - p=p+1; - } -} - znak2=array[i]; - i++; - j=0; - j=0; -while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - answer[j]=array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' '){ - i=i+1; - }else{ - i=i+1; - p=p+1; - } - } - j=0; - float firstN = atof(number1); - float secondN = atof(number2); - float answer1 = atof(answer); - if(znak1=='-'){ - myAnswer=firstN-secondN; - } - else if(znak1=='+'){ - myAnswer=firstN+secondN; - } - else if(znak1=='/'){ - myAnswer=firstN/secondN; - } - else if(znak1=='*'){ - myAnswer=firstN*secondN; - } - zero = myAnswer-answer1; - if(zero>=-0.00001&&zero<=0.00001){ - printf("OK\n"); - } - else{ - printf("ZLE\n"); - } - i=0; - p=-1; - memset(array,0,100); - } - p=p+1; - t=t+1; - scanf("\n%c",&q); - if(c=='\n'){ - return 0; - } -} - return 0; -} \ No newline at end of file From 6277fd5976bdbb505aae733af76d2e59cec62db0 Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 13:02:29 +0000 Subject: [PATCH 12/16] Upload files to 'du4' --- du4/program.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 du4/program.c diff --git a/du4/program.c b/du4/program.c new file mode 100644 index 0000000..ea71802 --- /dev/null +++ b/du4/program.c @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +char array[100]; +char array1[100]; +char number1[100]; +char number2[100]; +char answer[100]; +int p=0; +float zero=0; +char znak1; +char znak2; +float firstN=0; +float secondN=0; +float answer1=0; +float myAnswer=0; +char c; +char r; +char q; +int count = 0; +int scan(char* array2){ +char* r = fgets(array1,100,stdin); +if (r == NULL){ + return -1; +} + else{ + return 0; + } +} +int main(){ +scan(array1); +int i=0; +while(i<100){ + i=i+1; + if(array1[i]!='\n'){ + count=count+1; + } + if(array1[i]=='\n'){ + if(array1[i+1]=='\n') + { + array1[i]='#'; + break; + } + } + else + { + count=count+1; + } +} +i=0; +int j=0; +int t=0; +while(array1[t]!='#'){ + array[p]=array1[t]; + if(array1[t]=='='){ + t=t+1; + p=p+1; + if(array1[t]==' '){ + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array1[t]!=' ') + { + if(array1[t]=='#'){ + break; + } + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array[i]!='\0'){ + if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ + break; + } + else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number1[j]= array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' ' || isalpha(array[i])){i++;} + else{ + printf("CHYBA\n"); + return 0; + } + } + znak1=array[i]; + i=i+1; + j=0; + while(array[i]!='='){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number2[j]=array[i]; + j=j+1; + i=i+1; + } + else if(array[i]==' '){ + i=i+1; + } + else{ + i=i+1; + p=p+1; + } +} + znak2=array[i]; + i++; + j=0; + j=0; +while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + answer[j]=array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' '){ + i=i+1; + }else{ + i=i+1; + p=p+1; + } + } + j=0; + float firstN = atof(number1); + float secondN = atof(number2); + float answer1 = atof(answer); + if(znak1=='-'){ + myAnswer=firstN-secondN; + } + else if(znak1=='+'){ + myAnswer=firstN+secondN; + } + else if(znak1=='/'){ + myAnswer=firstN/secondN; + } + else if(znak1=='*'){ + myAnswer=firstN*secondN; + } + zero = myAnswer-answer1; + if(zero>=-0.00001&&zero<=0.00001){ + printf("OK\n"); + } + else{ + printf("ZLE\n"); + } + i=0; + p=-1; + memset(array,0,100); + } + p=p+1; + t=t+1; + scanf("\n%c",&q); + if(c=='\n'){ + return 0; + } +} + return 0; +} \ No newline at end of file From 8c592b7facd5b99a10f59fa31e98ad1756b78214 Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 13:07:35 +0000 Subject: [PATCH 13/16] Delete 'du4/program.c' --- du4/program.c | 158 -------------------------------------------------- 1 file changed, 158 deletions(-) delete mode 100644 du4/program.c diff --git a/du4/program.c b/du4/program.c deleted file mode 100644 index ea71802..0000000 --- a/du4/program.c +++ /dev/null @@ -1,158 +0,0 @@ -#include -#include -#include -#include -#include -char array[100]; -char array1[100]; -char number1[100]; -char number2[100]; -char answer[100]; -int p=0; -float zero=0; -char znak1; -char znak2; -float firstN=0; -float secondN=0; -float answer1=0; -float myAnswer=0; -char c; -char r; -char q; -int count = 0; -int scan(char* array2){ -char* r = fgets(array1,100,stdin); -if (r == NULL){ - return -1; -} - else{ - return 0; - } -} -int main(){ -scan(array1); -int i=0; -while(i<100){ - i=i+1; - if(array1[i]!='\n'){ - count=count+1; - } - if(array1[i]=='\n'){ - if(array1[i+1]=='\n') - { - array1[i]='#'; - break; - } - } - else - { - count=count+1; - } -} -i=0; -int j=0; -int t=0; -while(array1[t]!='#'){ - array[p]=array1[t]; - if(array1[t]=='='){ - t=t+1; - p=p+1; - if(array1[t]==' '){ - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array1[t]!=' ') - { - if(array1[t]=='#'){ - break; - } - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array[i]!='\0'){ - if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ - break; - } - else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number1[j]= array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' ' || isalpha(array[i])){i++;} - else{ - printf("CHYBA\n"); - return 0; - } - } - znak1=array[i]; - i=i+1; - j=0; - while(array[i]!='='){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number2[j]=array[i]; - j=j+1; - i=i+1; - } - else if(array[i]==' '){ - i=i+1; - } - else{ - i=i+1; - p=p+1; - } -} - znak2=array[i]; - i++; - j=0; - j=0; -while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - answer[j]=array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' '){ - i=i+1; - }else{ - i=i+1; - p=p+1; - } - } - j=0; - float firstN = atof(number1); - float secondN = atof(number2); - float answer1 = atof(answer); - if(znak1=='-'){ - myAnswer=firstN-secondN; - } - else if(znak1=='+'){ - myAnswer=firstN+secondN; - } - else if(znak1=='/'){ - myAnswer=firstN/secondN; - } - else if(znak1=='*'){ - myAnswer=firstN*secondN; - } - zero = myAnswer-answer1; - if(zero>=-0.00001&&zero<=0.00001){ - printf("OK\n"); - } - else{ - printf("ZLE\n"); - } - i=0; - p=-1; - memset(array,0,100); - } - p=p+1; - t=t+1; - scanf("\n%c",&q); - if(c=='\n'){ - return 0; - } -} - return 0; -} \ No newline at end of file From 07d7fb4d0a4c81cad10ee9d133ea06fe73f4899b Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 13:08:23 +0000 Subject: [PATCH 14/16] Add 'du4/program.c' --- du4/program.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 du4/program.c diff --git a/du4/program.c b/du4/program.c new file mode 100644 index 0000000..ea71802 --- /dev/null +++ b/du4/program.c @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +char array[100]; +char array1[100]; +char number1[100]; +char number2[100]; +char answer[100]; +int p=0; +float zero=0; +char znak1; +char znak2; +float firstN=0; +float secondN=0; +float answer1=0; +float myAnswer=0; +char c; +char r; +char q; +int count = 0; +int scan(char* array2){ +char* r = fgets(array1,100,stdin); +if (r == NULL){ + return -1; +} + else{ + return 0; + } +} +int main(){ +scan(array1); +int i=0; +while(i<100){ + i=i+1; + if(array1[i]!='\n'){ + count=count+1; + } + if(array1[i]=='\n'){ + if(array1[i+1]=='\n') + { + array1[i]='#'; + break; + } + } + else + { + count=count+1; + } +} +i=0; +int j=0; +int t=0; +while(array1[t]!='#'){ + array[p]=array1[t]; + if(array1[t]=='='){ + t=t+1; + p=p+1; + if(array1[t]==' '){ + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array1[t]!=' ') + { + if(array1[t]=='#'){ + break; + } + array[p]=array1[t]; + t=t+1; + p=p+1; + } + while(array[i]!='\0'){ + if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ + break; + } + else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number1[j]= array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' ' || isalpha(array[i])){i++;} + else{ + printf("CHYBA\n"); + return 0; + } + } + znak1=array[i]; + i=i+1; + j=0; + while(array[i]!='='){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + number2[j]=array[i]; + j=j+1; + i=i+1; + } + else if(array[i]==' '){ + i=i+1; + } + else{ + i=i+1; + p=p+1; + } +} + znak2=array[i]; + i++; + j=0; + j=0; +while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ + if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ + answer[j]=array[i]; + i=i+1; + j=j+1; + } + else if(array[i]==' '){ + i=i+1; + }else{ + i=i+1; + p=p+1; + } + } + j=0; + float firstN = atof(number1); + float secondN = atof(number2); + float answer1 = atof(answer); + if(znak1=='-'){ + myAnswer=firstN-secondN; + } + else if(znak1=='+'){ + myAnswer=firstN+secondN; + } + else if(znak1=='/'){ + myAnswer=firstN/secondN; + } + else if(znak1=='*'){ + myAnswer=firstN*secondN; + } + zero = myAnswer-answer1; + if(zero>=-0.00001&&zero<=0.00001){ + printf("OK\n"); + } + else{ + printf("ZLE\n"); + } + i=0; + p=-1; + memset(array,0,100); + } + p=p+1; + t=t+1; + scanf("\n%c",&q); + if(c=='\n'){ + return 0; + } +} + return 0; +} \ No newline at end of file From 467a56336427981a640aaf2bd362d4f0fe4feece Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 13:10:16 +0000 Subject: [PATCH 15/16] Upload files to 'du4' From 73ded258b3a25825ff7925bdfca67a8285f14a60 Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 13:13:37 +0000 Subject: [PATCH 16/16] Delete 'du4/program.c' --- du4/program.c | 158 -------------------------------------------------- 1 file changed, 158 deletions(-) delete mode 100644 du4/program.c diff --git a/du4/program.c b/du4/program.c deleted file mode 100644 index ea71802..0000000 --- a/du4/program.c +++ /dev/null @@ -1,158 +0,0 @@ -#include -#include -#include -#include -#include -char array[100]; -char array1[100]; -char number1[100]; -char number2[100]; -char answer[100]; -int p=0; -float zero=0; -char znak1; -char znak2; -float firstN=0; -float secondN=0; -float answer1=0; -float myAnswer=0; -char c; -char r; -char q; -int count = 0; -int scan(char* array2){ -char* r = fgets(array1,100,stdin); -if (r == NULL){ - return -1; -} - else{ - return 0; - } -} -int main(){ -scan(array1); -int i=0; -while(i<100){ - i=i+1; - if(array1[i]!='\n'){ - count=count+1; - } - if(array1[i]=='\n'){ - if(array1[i+1]=='\n') - { - array1[i]='#'; - break; - } - } - else - { - count=count+1; - } -} -i=0; -int j=0; -int t=0; -while(array1[t]!='#'){ - array[p]=array1[t]; - if(array1[t]=='='){ - t=t+1; - p=p+1; - if(array1[t]==' '){ - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array1[t]!=' ') - { - if(array1[t]=='#'){ - break; - } - array[p]=array1[t]; - t=t+1; - p=p+1; - } - while(array[i]!='\0'){ - if(array[i]=='+'||array[i]=='-'||array[i]=='/'||array[i]=='*'){ - break; - } - else if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number1[j]= array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' ' || isalpha(array[i])){i++;} - else{ - printf("CHYBA\n"); - return 0; - } - } - znak1=array[i]; - i=i+1; - j=0; - while(array[i]!='='){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - number2[j]=array[i]; - j=j+1; - i=i+1; - } - else if(array[i]==' '){ - i=i+1; - } - else{ - i=i+1; - p=p+1; - } -} - znak2=array[i]; - i++; - j=0; - j=0; -while(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]==' '||array[i]=='.'){ - if(array[i]=='1'||array[i]=='2'||array[i]=='3'||array[i]=='4'||array[i]=='5'||array[i]=='6'||array[i]=='7'||array[i]=='8'||array[i]=='9'||array[i]=='0'||array[i]=='.'){ - answer[j]=array[i]; - i=i+1; - j=j+1; - } - else if(array[i]==' '){ - i=i+1; - }else{ - i=i+1; - p=p+1; - } - } - j=0; - float firstN = atof(number1); - float secondN = atof(number2); - float answer1 = atof(answer); - if(znak1=='-'){ - myAnswer=firstN-secondN; - } - else if(znak1=='+'){ - myAnswer=firstN+secondN; - } - else if(znak1=='/'){ - myAnswer=firstN/secondN; - } - else if(znak1=='*'){ - myAnswer=firstN*secondN; - } - zero = myAnswer-answer1; - if(zero>=-0.00001&&zero<=0.00001){ - printf("OK\n"); - } - else{ - printf("ZLE\n"); - } - i=0; - p=-1; - memset(array,0,100); - } - p=p+1; - t=t+1; - scanf("\n%c",&q); - if(c=='\n'){ - return 0; - } -} - return 0; -} \ No newline at end of file