9th Simple C++ Program - Tutorial

ssendi By ssendi, 13th Apr 2012 | Follow this author | RSS Feed | Short URL http://nut.bz/35lggb8h/
Posted in Wikinut>Guides>Technology>Computer Software

In this program we use calculating operations like adding, multiplying, dividing and subtracting numbers...

9th Simple C++ Program - Tutorial

/*
In this program we use calculating operations like adding, multiplying, dividing and subtracting numbers...
*/


#include <iostream>
using namespace std;
int main()
{
int option=1;
while(option!=0){
double number1;
double number2;
int option2;
cout<<"Choose the option that you want: "<<endl;
cout<<"1) Add two numbers... "<<endl;
cout<<"2) Subtract two numbers... "<<endl;
cout<<"3) Multiply two numbers... "<<endl;
cout<<"4) Divide two numbers... "<<endl;
cout<<"0) Exit... "<<endl;
cin>>option;
if(option!=0){
cout<<endl<<"Enter two numbers: "<<endl;
cin>>number1;
cin>>number2;
}
cout<<endl;
switch(option){
case 1:{
cout<<number1<<" + "<<number2<<" = "<<number1+number2<<endl;
break;
}
case 2:{
cout<<number1<<" - "<<number2<<" = "<<number1-number2<<endl;
break;
}
case 3:{
cout<<number1<<" x "<<number2<<" = "<<number1*number2<<endl;
break;
}
case 4:{
cout<<number1<<" : "<<number2<<" = "<<number1/number2<<endl;
break;
}
}
cout<<endl;
}
cout<<endl<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}


Here you can find more C++ Programs.....

moderator Steve Kinsman moderated this page.
If you have any complaints about this content, please let us know

Comments

author avatar cnwriter..carolina
14th Apr 2012 (#)

am not very savvy about this but I love numbers, Pythagoras a great teacher too. welcome to wikinut and glad to have you aboard. You come from a beautiful country and hope to hear more about that..

Reply to this comment

author avatar ssendi
14th Apr 2012 (#)

thank you....

Reply to this comment

author avatar Denise O
29th Jun 2012 (#)

Thank you for sharing.:)

Reply to this comment

author avatar Boss
26th May 2014 (#)

ths fr sharring

Reply to this comment

author avatar Boss
26th May 2014 (#)

super

Reply to this comment

Add a comment
Username
Can't login?
Password