+1

is there a way to turn a string with numbers and operators into an answer for the mathmatical equation in the string in C

i have a string like str ("300 / 400") the answer should be 0.750 . how can it be done in the C language ?

4/13/2019 2:37:32 PM

Anas Seh

2 Answers

New Answer

+9

its popular to use reverse polish notation with this situation https://en.m.wikipedia.org/wiki/Reverse_Polish_notation plus good practice for your analytical thinking ;) You would just have to cast the number strings to an actual integer or whatever numerical data type.