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;
|
return counter;
|
||||||
}
|
}
|
||||||
int analizing_string(char* pointer){
|
int analizing_string(char* pointer){
|
||||||
|
char token1[SIZE];
|
||||||
|
char token2[SIZE];
|
||||||
|
char token3[SIZE];
|
||||||
|
|
||||||
float number1, number2, result3;
|
float number1, number2, result3;
|
||||||
char buffer_for_token[SIZE];
|
char buffer_for_token[SIZE];
|
||||||
strcpy(buffer_for_token,pointer);
|
strcpy(buffer_for_token,pointer);
|
||||||
@ -83,23 +87,23 @@ int analizing_string(char* pointer){
|
|||||||
char delim[] =" +=-*/\n";
|
char delim[] =" +=-*/\n";
|
||||||
|
|
||||||
char *first_number_cucumber=strtok(buffer_for_token, delim);
|
char *first_number_cucumber=strtok(buffer_for_token, delim);
|
||||||
|
|
||||||
if(first_number_cucumber==NULL) {//||is_number_question_mark(first_number_cucumber)==0){
|
if(first_number_cucumber==NULL) {//||is_number_question_mark(first_number_cucumber)==0){
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
strcpy(token1, first_number_cucumber);
|
||||||
|
|
||||||
char *second_number=strtok(NULL, delim);
|
char *second_number=strtok(NULL, delim);
|
||||||
|
|
||||||
if(second_number==NULL) { //||is_number_question_mark(second_number)==0){
|
if(second_number==NULL) { //||is_number_question_mark(second_number)==0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
strcpy(token2, second_number);
|
||||||
|
|
||||||
|
|
||||||
char *result=strtok(NULL, delim);
|
char *result_token=strtok(NULL, delim);
|
||||||
if(result==NULL) { //||is_number_question_mark(result)==0){
|
if(result_token==NULL) { //||is_number_question_mark(result)==0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
strcpy(token3, result_token);
|
||||||
|
|
||||||
char *token = strtok(NULL, delim);
|
char *token = strtok(NULL, delim);
|
||||||
if(token!=NULL){
|
if(token!=NULL){
|
||||||
@ -107,9 +111,9 @@ int analizing_string(char* pointer){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
number1=atof(first_number_cucumber);
|
number1=atof(token1);
|
||||||
number2=atof(second_number);
|
number2=atof(token2);
|
||||||
result3=atof(result);
|
result3=atof(token3);
|
||||||
|
|
||||||
if(operant=='+' &&result3==number1+number2){
|
if(operant=='+' &&result3==number1+number2){
|
||||||
return 1;
|
return 1;
|
||||||
@ -135,3 +139,4 @@ int analizing_string(char* pointer){
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user