Kalkulator di CPP
#include <iostream>
using namespace std;
// Hi I'm Jillani Soft Tech. I'm a Developer.
main()
{
while(true)
{
int sum,mul,sub,div; // variable decalration
int num1,num2;
int choice;
cout<<"\n\n\t\t\t----------Main Menu-----------"<<endl;
cout<<"Press 1 for Sum "<<endl;
cout<<"Press 2 for Sub "<<endl;
cout<<"Press 3 for Mul "<<endl;
cout<<"Press 4 for Div "<<endl;
cout<<"\nEnter Your Choice ? "<<endl;
cin>>choice;
cout<<"Enter frist number : "<<endl;
cin>>num1;
cout<<"Enter Second number : "<<endl;
cin>>num2;
if(choice==1)
{
sum=num1+num2;
cout<<"There sum is this : "<<sum<<endl;
}
else if(choice==2)
{
sub=num1-num2;
cout<<"There sub is this : "<<sub<<endl;
}
else if(choice==3)
{
mul=num1*num2;
cout<<"There mul is this : "<<mul<<endl;
}
else if(choice==4)
{
div=num1/num2;
cout<<"There div is this : "<<div<<endl;
}
else
{
cout<<"\n\n\t\t\tInvalid Selection Try Again.... "<<endl;
}
}
}
Wicked Willet