Skip to main content

C++ program to MAke Simple calculator



For more discuss and ask question join this group
 
Solved  By : Tahir Siddiqui(Mani)






C++ program to Make Simple calculator


//Learn c Language by Tahir Siddiqui(Mani*)
//Virtual university of Pakistan
//tahirsiddiqui190@gmail.com

#include<iostream>
#include<cmath>

using namespace std;

int main()
{
double num1,num2;
char opr,redo;
    cout<<"Welcome to the calculater program written by Tahir Siddiqui(Mani*)"<<endl;
    cout<<"***************************************************************"<<endl;
    cout<<endl<<endl<<endl;
do
{
    cout<<"pleae enter ur desire opertaion which u like to calculate(+,-,*,/,s)";
    cout<<"[s stands for swap]:";
    cin>>opr;
    cout<<"please enter two # to apply ur requested operation (";
    cin>>num1;
    cin>>num2;
    switch(opr)
    {
        case'+':
            cout<<"the addition of 2 numbers ("<<num1<<","<<num2<<"):";
            cout<<num1+num2<<endl;
            break;
            case'-':
            cout<<"the addition of 2 numbers ("<<num1<<","<<num2<<"):";
            cout<<num1-num2<<endl;
            break;
            case'*':
            cout<<"the addition of 2 numbers ("<<num1<<","<<num2<<"):";
            cout<<num1*num2<<endl;
            break;
            case'/':
            cout<<"the addition of 2 numbers ("<<num1<<","<<num2<<"):";
            cout<<num1/num2<<endl;
            break;
            case's':
             cout<<"The swap of two numbers ("<<num1<<","<<num2<<"):";
             swap(num1,num2);
             cout<<"1stnumber="<<num1<<"and 2nd number="<<num2<<endl<<endl;                   
           break;
      default:
              cout<<"unknown command"<<endl;
     

    }
   
           cout<<"enter y or Y to continue:";
           cin>>redo;
           cout<<endl<<endl;
           }
           while(redo=='y'||redo=='Y');
          
       
   system("pause");
    return 0;
   
    }

Comments

Popular posts from this blog

IT Intern (Microsoft Product)

For more discuss and ask question join this group   https://www.facebook.com/groups/143792885956764/ Solved   By : Tahir Siddiqui(Mani) BC-140201235@Vu.edu.pk Job Description We offer Internship in IT 03 months Unpaid internship Responsible for Managing IT Products/Services. Maintains relationships with clients by providing support, information, and guidance. Good presentation skills. Good oral & written communication knowledge of MS Office 50%. Traveling Required Team Work Candidate must have a Motor Bike and laptop. Fresh candidates are encouraged to apply. Job Details Industry: Information Technology ...

cs403 GDB Solution 2016

cs403 GDB 2016 For more discuss and ask question join this group   https://www.facebook.com/groups/143792885956764/ Posted By : Tahir Siddiqui(Mani)  Total Marks                                   5 Starting Date Wednesday, July 27, 2016 Closing Date Thursday, July 28, 2016 ...