- #1
soul5
- 64
- 0
I'm doing an excerise to make factions, but I need to simulate a \frac{}{}
command. To display numbers in faction AND decimal form. How do I simulate a
\frac{}{} command? Thanks. Like I have to prompt the user.
Enter fraction in the form n1/n2:
1
\frac{1}{2} is --
2
or 0.5
how do I make it to decimal?
command. To display numbers in faction AND decimal form. How do I simulate a
\frac{}{} command? Thanks. Like I have to prompt the user.
Code:
int denominator, numerator;
scanf("\\frac{%d}{%d}", &numerator, &denominator);
cout << numerator << " / " << denominator;
Enter fraction in the form n1/n2:
1
\frac{1}{2} is --
2
or 0.5
how do I make it to decimal?