Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i have to enter a string with the mathematical function \"2/3+3/8*3/9\" I need t

ID: 3553219 • Letter: I

Question

i have to enter a string with the mathematical function "2/3+3/8*3/9"


I need to make a split using the "/" character, so that iI can take the numerator and denominators into new strings(or a better solution that you tcan think off, take also the operators. calculate the comon divider, do the multiplication first then the sum.


is there any function like atoi in C++ that allows me to change a string location to Int.


here is the problem


Design and build a rational number calculator program. This calculator should read the mathematical

expression as an user input and add (+), subtract (-), multiply (*) or divide (/) the rational numbers. The

program should do the calculation using c# operator precedence rule; * and / are perform before + and -. It

also search for the maximum common divider to simplify the result.

The following is a sample run of the program

Input the mathematical expression: 1/3 * 2/4 + 5/9

Output: 1/3 * 2/4 + 5/9 = 78/108 = 13/18

Explanation / Answer

#include #include #include "rtnl.h"// included in zipvoid main() { clrscr(); Rational r1,r2,sum,sub,mul,div; printf(" Enter the First Rational Number."); r1=getRational(); printf(" Enter the Second Rational Number."); r2=getRational(); sum=addRational(r1,r2); sub=subtractRational(r1,r2); mul=multiplyRational(r1,r2); div=divideRational(r1,r2); printf(" ADDITION IS : "); displayRational(sum); printf(" SUBTRACTION IS : "); displayRational(sub); printf(" MULTIPLICATION IS : "); displayRational(mul); printf(" DIVISION IS : "); displayRational(div); getch(); }