How can I write a c++ program that will be able to add fractions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I write a c++ program that will be able to add fractions

24th Apr 2018, 7:50 PM
Ibimilua Ayodeji Oluwatosin
Ibimilua Ayodeji Oluwatosin - avatar
5 Answers
+ 2
fractions?the only i think of is converting to decimals summing it up,and re-expressing it as a fraction
24th Apr 2018, 8:12 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 2
Make a fraction templated struct/class and then a function that adds the numerators of such objects
24th Apr 2018, 8:24 PM
TurtleShell
TurtleShell - avatar
+ 2
Here's a solution for you. It allows adding and multiplying of fractions, and simplifies the fractions along the way: https://code.sololearn.com/cL9J1KB2dr41/#cpp
24th Apr 2018, 9:34 PM
Emma
+ 2
https://code.sololearn.com/cKhLJHkLvEv7/?ref=app
25th Apr 2018, 11:27 AM
KrOW
KrOW - avatar
0
thank you guys
25th Apr 2018, 2:10 AM
Ibimilua Ayodeji Oluwatosin
Ibimilua Ayodeji Oluwatosin - avatar