0% found this document useful (0 votes)
718 views

Scientific Calculator in C++

This C++ program is a simple calculator that allows the user to perform basic math operations like addition, subtraction, division, multiplication, and calculating the area of a square. The user is prompted to select an operation and then enter the necessary values. The program will then display the result. This loop continues indefinitely until the program is closed.

Uploaded by

Hannan Mumtaz
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
718 views

Scientific Calculator in C++

This C++ program is a simple calculator that allows the user to perform basic math operations like addition, subtraction, division, multiplication, and calculating the area of a square. The user is prompted to select an operation and then enter the necessary values. The program will then display the result. This loop continues indefinitely until the program is closed.

Uploaded by

Hannan Mumtaz
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <cstdlib>

#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char ch[5];
int op;
system("color f3");
// if you have any more problems send me i will give you thhe answers ok
cout<<"\t***********************MUZAMAL calculator**************************
"<<endl;;
cout<<endl;

while(1){
cout<<"\t1.addition"<<endl;
cout<<"\t2.subtrection"<<endl;
cout<<"\t3.division"<<endl;
cout<<"\t4.multiplication"<<endl;
cout<<"\t5.area of square"<<endl;
cout<<"enter your option"<<endl;
cin>>op;

cout<<"you slected "<<op<<endl;


switch(op){
case 1:
int a,c,sum;
cout<<"enter the first number"<<endl;
cin>>a;
cout<<"enter the 2nd number"<<endl;
cin>>c;
sum=a+c;
cout<<"sum =" <<sum<<endl;
break;
case 2:
int a1,c1,sub;
cout<<"enter the first number"<<endl;
cin>>a1;
cout<<"enter the 2nd number"<<endl;
cin>>c1;
sub=a1+c1;
cout<<"subtrection =" <<sub<<endl;
break;
case 3:
int a2,c2,div;
cout<<"enter the first number"<<endl;
cin>>a2;
cout<<"enter the 2nd number"<<endl;
cin>>c2;
div=a2/c2;
cout<<"division =" <<div<<endl;
break;
case 4:
int a3,c3,mult;
cout<<"enter the first number"<<endl;
cin>>a3;
cout<<"enter the 2nd number"<<endl;
cin>>c3;
mult=a3*c3;
cout<<"multiply =" <<mult<<endl;
break;
case 5:
int a4,area;float c4=3.14;
cout<<"enter the radius"<<endl;
cin>>a4;
area=c4*(a4*a4)*(0.5);
cout<<"area of square =" <<area<<endl;
break; }
}
system("PAUSE");
return EXIT_SUCCESS;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy