Thursday, 24 January 2013

do while calculator manu

#include <iostream>
#include <string>

using namespace std;

int main()
{char opt;
    int num1,num2;


    char option;
    do
    {





        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";

}
cout << "\nif you want continou press 'Y' or 'N' for no ";
cin >> opt;
    }




    while(opt=='y'|| opt == 'Y');


    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