Prompts the user for the numerator and denominator of a rational number. Stores number in reduced form.
What will be an ideal response?
```
{
int greatest;
int sign;
cout << "Input numerator:";
cin >> numer;
cout << "Input denominator:";
cin >> denom;
if (numer * denom < 0)
sign = -1;
else
sign = 1;
numer = abs( numer ) * sign;
denom = abs( denom );
greatest = gcd( numer, denom );
numer /= greatest;
denom /= greatest;
}
```
You might also like to view...
Answer the following statements true (T) or false (F)
1. The do-while loop must be terminated with a semicolon. 2. The do-while loop is ideal in situations where you always want the loop to iterate at least once. 3. When you pass the name of a file to the PrintWriter constructor and the file already exists, it will be erased and a new empty file with the same name will be created. 4. When you open a file with the PrintWriter class, the class can potentially throw an IOException.
Assign the value 1.667 to array element 9.
Perform the tasks for an array called fractions:
The Control panel is accessible within the Story Editor, enabling you to make formatting changes in addition to editing the text.
Answer the following statement true (T) or false (F)
The main difference between a letter and a memo is the target ________
Fill in the blank(s) with correct word