Question #27376

A fraction-handling program contains this menu:

A. Add two fractions

B. Convert a fraction to decimal

C. Multiply two fractions

Q. Quit

A. Add two fractions

B. Convert a fraction to decimal

C. Multiply two fractions

Q. Quit

Expert's answer

#include <iostream>

using namespace std;

int main() {

cout<< "A. Add two fractions

"

"B.Convert a fraction to decimal

"

"C.Multiply two fractions

"

"Q.Quit

";

boolok_choice = false;

while(ok_choice != true) {

charchoice;

cout<< "Please enter your choice: ";

cin>> choice;

//inOK cases you can insert functions that you need

switch(choice) {

case'A':

cout<< "ADD

";

//addFrac(Frac1,Frac2); - example

ok_choice= true;

break;

case'B':

cout<< "ToDecimal

";

ok_choice= true;

break;

case'C':

cout<< "Multiply

";

ok_choice= true;

break;

case'Q':

cout<< "Quit

";

ok_choice= true;

break;

default:

cout<< "Bad choice!

";

break;

}

}

return0;

}

using namespace std;

int main() {

cout<< "A. Add two fractions

"

"B.Convert a fraction to decimal

"

"C.Multiply two fractions

"

"Q.Quit

";

boolok_choice = false;

while(ok_choice != true) {

charchoice;

cout<< "Please enter your choice: ";

cin>> choice;

//inOK cases you can insert functions that you need

switch(choice) {

case'A':

cout<< "ADD

";

//addFrac(Frac1,Frac2); - example

ok_choice= true;

break;

case'B':

cout<< "ToDecimal

";

ok_choice= true;

break;

case'C':

cout<< "Multiply

";

ok_choice= true;

break;

case'Q':

cout<< "Quit

";

ok_choice= true;

break;

default:

cout<< "Bad choice!

";

break;

}

}

return0;

}

## Comments

## Leave a comment