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

Write A Program To Make A Calculator.: C++ Programs

The document describes a C++ program to create a basic calculator. The program prompts the user to enter two numbers and an operator, performs the calculation based on the operator, and stores the result. It uses input/output streams, a switch statement to evaluate the operator, and basic arithmetic operations to build a simple calculator that adds, subtracts, multiplies, divides and calculates percentages.

Uploaded by

musicalblizzard
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Write A Program To Make A Calculator.: C++ Programs

The document describes a C++ program to create a basic calculator. The program prompts the user to enter two numbers and an operator, performs the calculation based on the operator, and stores the result. It uses input/output streams, a switch statement to evaluate the operator, and basic arithmetic operations to build a simple calculator that adds, subtracts, multiplies, divides and calculates percentages.

Uploaded by

musicalblizzard
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1. Write a Program to make a Calculator.

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int s;
float a,b,r;
char op;
cout<<"Please Enter a no.: ";
cin>>a;
cout<<"Please Enter operation to be performed.:(+,-,*,/,%) ";
cin>>op;
cout<<"Please Enter another no.: ";
cin>>b;
switch (op)
{
case '+':
r=a+b;
break;
case '-':
r=a-b;
C++ programs

Page 1

You might also like