Thursday, 24 January 2013

Menu for add subtract multiplication

#include <iostream>
#include <iomanip>

using namespace std;

int main()

{   int num1,num2;

    char option;


        cout << "enter your 1st number = ";
           cin >> num1;


        cout << "enter your 2nd number = ";
           cin >> num2;

cout << " What you want to do? \n";

cout << "a: ADD \n" << "b: SUB\n" << "c: MUL\n" << "d: DIV\n";
cout << "Type number of any option Example a,b,c,d\n";


cin >> option;


if ( option=='a')
{

    cout << "The addition is = ";
    cout << num1+num2;
}

else if (option == 'b')
{
    cout << "The subtraction is = " << num1-num2;


}

else if (option == 'c')
{
    cout << "The Multiplication is = " << num1*num2;
}


else if(option == 'd')
{
    cout << "The Division is = " << showpoint << num1/num2;
}

 else

{
    cout << "please type valid options\n";
}
cin.get();


   return 0;
}

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Enterprise Project Management