the program reads two numbers and a


The program reads two numbers and a character (operator). If the character is "+" then sum is displayed. If it is "-"then difference is displayed. If it is "*" then product is displayed. If it is "/" then quotient is displayed. Use a switch statement.

#include 

using  namespace  std;
int  main  (  )

{

int  number1,  number2,  answer1,choice; float  answer2;

/*  menu  of  operation*/

cout<<"Menu  of  Operations"< cout<<"2  Division  "< cout<<"3  Addition  "< cout<<"4  Subtraction  "< /*end  of  menu*/

cout<<"enter  the  two  integer  numbers:  "<>number1>>number2;

cout<<"enter  your  choice:  "< cin>>choice;

/*  make  use  of  the  switch  case  construct
   to  make  decisions*/

switch  (choice)

{

case  1:

answer1=  number1  *  number2;

cout<

case  2:

answer2=  number1  /  number2;

cout<case  3:

answer1=  number1  +  number2;

cout<

case  4:

answer1=  number1  -  number2;

cout<

default:

cout<<"invalid  operator"<

}

return  0;

}

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: the program reads two numbers and a
Reference No:- TGS0158497

Expected delivery within 24 Hours