Display the sum and difference of two rational numbers

What will be an ideal response?


```
nt main()
{
int numer1, denom1, numer2, denom2;
int ansNumer, ansDenom;

getRational( numer1, denom1 );
getRational( numer2, denom2 );

//display original rationals
displayRational( numer1, denom1 );
cout << " ";
displayRational( numer2, denom2 );
cout << endl << endl;

//display sum
addRational( ansNumer, ansDenom, numer1, denom1, numer2, denom2 );
displayRational( numer1, denom1 );
cout << " + ";
displayRational( numer2, denom2 );
cout << " = ";
displayRational( ansNumer, ansDenom );
cout << endl << endl;

//display difference
subtractRational( ansNumer, ansDenom, numer1, denom1,
numer2, denom2 );
displayRational( numer1, denom1 );
cout << " - ";
displayRational( numer2, denom2 );
cout << " = ";
displayRational( ansNumer, ansDenom );
cout << endl;

return 0;
}

```

Computer Science & Information Technology

You might also like to view...

Mathematicians have discovered that many of the spirals that occur in nature use a pattern given in the ____ series.

A. Fibonacci B. Goedel C. Church D. Pythagorean

Computer Science & Information Technology

A(n) ____________________ array is defined as any array that has more then one dimension.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

When only one document is open, the View Side by Side command:

A) is grayed out. B) shows other file names that have been revised. C) appears active similar to all other buttons in the Window group. D) shows with an orange background indicating it is active.

Computer Science & Information Technology

Give an example of how cardinality relates to business policy.

What will be an ideal response?

Computer Science & Information Technology