From b438c121f760a5f164a5b19fafa6feadc5345a7a Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Wed, 30 Mar 2022 13:00:16 +0000 Subject: [PATCH] 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