submition7
This commit is contained in:
parent
9260a40089
commit
52a3b7325d
21
a1/program.c
21
a1/program.c
@ -62,6 +62,10 @@ int reading_strings_and_storing_them_in_memory(link* pointer_to_start_of_chain){
|
||||
return counter;
|
||||
}
|
||||
int analizing_string(char* pointer){
|
||||
char token1[SIZE];
|
||||
char token2[SIZE];
|
||||
char token3[SIZE];
|
||||
|
||||
float number1, number2, result3;
|
||||
char buffer_for_token[SIZE];
|
||||
strcpy(buffer_for_token,pointer);
|
||||
@ -83,23 +87,23 @@ int analizing_string(char* pointer){
|
||||
char delim[] =" +=-*/\n";
|
||||
|
||||
char *first_number_cucumber=strtok(buffer_for_token, delim);
|
||||
|
||||
if(first_number_cucumber==NULL) {//||is_number_question_mark(first_number_cucumber)==0){
|
||||
|
||||
return -1;
|
||||
}
|
||||
strcpy(token1, first_number_cucumber);
|
||||
|
||||
char *second_number=strtok(NULL, delim);
|
||||
|
||||
if(second_number==NULL) { //||is_number_question_mark(second_number)==0){
|
||||
return -1;
|
||||
}
|
||||
strcpy(token2, second_number);
|
||||
|
||||
|
||||
char *result=strtok(NULL, delim);
|
||||
if(result==NULL) { //||is_number_question_mark(result)==0){
|
||||
char *result_token=strtok(NULL, delim);
|
||||
if(result_token==NULL) { //||is_number_question_mark(result)==0){
|
||||
return -1;
|
||||
}
|
||||
strcpy(token3, result_token);
|
||||
|
||||
char *token = strtok(NULL, delim);
|
||||
if(token!=NULL){
|
||||
@ -107,9 +111,9 @@ int analizing_string(char* pointer){
|
||||
}
|
||||
|
||||
|
||||
number1=atof(first_number_cucumber);
|
||||
number2=atof(second_number);
|
||||
result3=atof(result);
|
||||
number1=atof(token1);
|
||||
number2=atof(token2);
|
||||
result3=atof(token3);
|
||||
|
||||
if(operant=='+' &&result3==number1+number2){
|
||||
return 1;
|
||||
@ -135,3 +139,4 @@ int analizing_string(char* pointer){
|
||||
}
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user