numerator - cout << "The sum is:\n"; cout...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
# include <iostream> using namespace std; int main(void) { int nom1,nom2,den1,den2; float sum; cout << "Enter the fractions, first the nominator and then the denominator divided by space \n"; cin >> nom1 >> den1 >> nom2 >> den2; sum = (float)(nom1+nom2)/(den1+den2); // casting from int to float
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout << "The sum is:\n"; cout << nom1 << "/" << den1 << "+" << nom2 << "/" << den2 << "=" << nom1+nom2 << "/" << den1+den2 << "or" << sum; return 0; }...
View Full Document

This note was uploaded on 04/24/2010 for the course COS 120 taught by Professor Bonev during the Fall '08 term at American University in Bulgaria.

Ask a homework question - tutors are online