im learning by my own how to code with C++, i got to the topic of Structures. The book has some exercises and i am atempting to complete them..
it asks for a program that would be able to add fractions..
i have somehow an idea of how it would be, but my here's my problem.
I ask for the fraction, i would like to have that fraction compared to a variable thus making it decimal, so i can perform any operation (+, -, x, /) with decimals, and if possible that most common fractions be displayed (1/2, 1/4, 1/8) but not like1/3453.
here's the code of what i been working..
using namespace std;
struct math //structure tag
math fraction; //define the structure object
cout<<"Enter the first integer: ";
if (fraction.firstInteger= 1/2)
cout<<"___this is the equivalent" <<equivalent<<endl;
cout<<"Your 1st Integer is: \n["<<fraction.firstInteger<<" ]"<<endl;
//End of code
any help would be appreciated, THANK YOU!