+ 2
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 ?
1 Odpowiedź
0
You can use the sscanf() function to parse the string and extract the operands and operator, then perform the calculation based on the extracted values and switch statement to handle different operators.
Here is the code⤵️
https://sololearn.com/compiler-playground/cXcpCgYXegkU/?ref=app