2025-01-31 18:14:04 +00:00
|
|
|
#include "calculator.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2025-01-31 21:16:44 +00:00
|
|
|
#include <string.h>
|
2025-01-31 18:14:04 +00:00
|
|
|
|
|
|
|
int main() {
|
2025-01-31 21:16:44 +00:00
|
|
|
char infix[100], postfix[100];
|
2025-01-31 18:14:04 +00:00
|
|
|
printf("Zadajte matematický výraz: ");
|
|
|
|
fgets(infix, sizeof(infix), stdin);
|
|
|
|
|
2025-01-31 21:16:44 +00:00
|
|
|
|
2025-01-31 21:14:34 +00:00
|
|
|
infix[strcspn(infix, "\n")] = 0;
|
2025-01-31 21:16:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
infix_na_postfix(infix, postfix);
|
2025-01-31 18:14:04 +00:00
|
|
|
printf("Postfixová notácia: %s\n", postfix);
|
|
|
|
|
2025-01-31 21:16:44 +00:00
|
|
|
|
2025-01-31 18:14:04 +00:00
|
|
|
double vysledok = vyhodnot_postfix(postfix);
|
|
|
|
printf("Výsledok: %.2f\n", vysledok);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|