fix s nespravnymi operatormi 4
This commit is contained in:
parent
e67bc5e4a8
commit
a4f88b62de
@ -18,6 +18,7 @@ int main() {
|
||||
int index = 0;
|
||||
while (fgets(buffer, sizeof(buffer), stdin) != NULL) {
|
||||
int error = 0;
|
||||
int operator_count = 0;
|
||||
if (buffer[0] == '\n') break;
|
||||
index = 0;
|
||||
eq_index = 0;
|
||||
@ -47,6 +48,7 @@ int main() {
|
||||
equation[eq_index][0] = buffer[index];
|
||||
equation[eq_index][1] = '\0';
|
||||
eq_index++;
|
||||
operator_count++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
@ -54,6 +56,12 @@ int main() {
|
||||
equation[eq_index][eq_operand_length] = '\0';
|
||||
eq_index++;
|
||||
}
|
||||
if (operator_count < 2) {
|
||||
error = 1;
|
||||
strcpy(output[output_length], "CHYBA");
|
||||
output_length++;
|
||||
|
||||
}
|
||||
float total = 0.0;
|
||||
char last_operator = '+';
|
||||
int sign = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user