int main()
{
cout << "Insert upper and lower part of the fraction: ";
int a,b;
cin >> a >> b;
cout << "\n";
cout << "Insert upper and lower part of the fraction: ";
int c,d;
cin >> c >> d;
int e,f;
e = a*d+b*c;
f = b*d;
cout << "a/b + c/d = " << e << "/" << f;
cout << "\n";
return 0;
}
I think what Bazzy wanted to say is that it depends on the format of the answer that you want. Do you want your answer to be displayed as fraction? Or, you want your answer to be displayed with decimal point number.
You could go to the library or the nearest book shop and get "C++ Without Fear" by Brian Overland. In this book you'll find how to make it and why it works.