submition12
This commit is contained in:
parent
5bc5ceae60
commit
5dfd9a0469
15
a1/program.c
15
a1/program.c
@ -136,12 +136,13 @@ int analizing_string(char* pointer){
|
|||||||
number2 = round(number2 *100) / 100;
|
number2 = round(number2 *100) / 100;
|
||||||
result3 = round(result3 *100) / 100;
|
result3 = round(result3 *100) / 100;
|
||||||
|
|
||||||
|
// printf("number1 = %s, number2 = %s, result3 = %s\n", first_number, second_number, result_nubmer);
|
||||||
|
// printf("number1 = %f, number2 = %f, result3 = %f\n", number1, number2, result3);
|
||||||
|
|
||||||
|
if(operant=='+' &&result3==round((number1+number2) * 100) / 100){
|
||||||
if(operant=='+' &&result3==number1+number2){
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(operant=='-'&&(result3==number1-number2)){
|
if(operant=='-'&&(result3==round((number1-number2) * 100) / 100)){
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(operant=='*'&&(result3==round((number1*number2) * 100) / 100)){
|
if(operant=='*'&&(result3==round((number1*number2) * 100) / 100)){
|
||||||
@ -177,4 +178,12 @@ int copy_number(char number[], char *pointer, int i) {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*int is_number_question_mark(char *pointer){
|
||||||
|
for(int i=0; pointer[i]!='\0'; i++){
|
||||||
|
if (!isdigit(pointer[i])&&pointer[i]!='.'&&pointer[i]!=',') {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user