Here is how to make a calculator in C++ language.
[sourcecode language='cpp']
#include
#include
{
int num1,num2,res;
char ch,choice,count;
count=0;
z:
cout<<"*******************************************************************************"<
switch(ch)
{
case ‘+’:
cout<<"/////////////////////////"<
res=num1+num2;
cout<<"Your query returned"<<" "<
case '-':
cout<<"/////////////////////////"<
res=num1-num2;
cout<<"Your query returned"<<" "<
case '*':
cout<<"/////////////////////////"<
res=num1*num2;
cout<<"Your query returned"<<" "<
case '/': }; This program also has an inbuilt limitation of limiting the usage upto three times only.
m:
cout<<"/////////////////////////"<
if(num2==0)
{
cout<<"Sorry, please enter a value which is not zero"<
}
res=num1/num2;
cout<<"Your query returned"<<" "<
default:
cout<<"Please select anyone option"<
if(count==3)
{cout<<"You already used the program thrice...";
exit(0);}
cout<<"::::::::::::::::::::::::::::::::::::::::"<
if((choice==’Y')||(choice==’y'))
{goto z;}
}
[/sourcecode]
