RPN: use float

This commit is contained in:
starnakin 2023-12-16 14:13:52 +01:00
parent fee188de95
commit 0852968609

View File

@ -10,7 +10,7 @@ int addition(int a, int b) { return (a + b); }
int division(int a, int b) { return (a / b); }
int multiplication(int a, int b) { return (a * b); }
int calculate(std::stack<int>& nums, std::stack<char>& operators)
int calculate(std::stack<float>& nums, std::stack<char>& operators)
{
if (nums.size() < 2 || operators.size() == 0)
return 2;
@ -50,7 +50,7 @@ int main(int ac, char** av)
return 1;
}
std::stack<int> nums;
std::stack<float> nums;
std::stack<char> operators;
for (size_t i = 0; av[1][i] != '\0'; i++)