diff --git a/a1/program.c b/a1/program.c index e59b2d7..38ea520 100644 --- a/a1/program.c +++ b/a1/program.c @@ -76,7 +76,7 @@ int analizing_string(char* pointer){ int i = 0; int counter=0; while(pointer[i]!='\0'){ - if(pointer[i]=='+'||pointer[i]=='/'||pointer[i]=='*'||pointer[i]=='-'){ + if(pointer[i]=='+'||pointer[i]=='/'||pointer[i]=='*'){ operant=pointer[i]; counter++; if(counter>1){ @@ -158,14 +158,16 @@ int skip_spaces(int i, char *pointer) { int copy_number(char number[], char *pointer, int i) { int destination_i = 0; while(pointer[i]!='\0'){ - if (!isdigit(pointer[i])&&pointer[i]!='.'&&pointer[i]!=',') { + if (!isdigit(pointer[i])&&pointer[i]!='.'&&pointer[i]!=','&&pointer[i]!='-') { + break; + } + if (pointer[i] == '-' && destination_i > 0) { break; } number[destination_i] = pointer[i]; destination_i++; i++; } - return i; }