0% found this document useful (0 votes)
35 views7 pages

Oops Microproject

Uploaded by

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

Oops Microproject

Uploaded by

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

ABSTRACT

1. Calculators are widely used device nowadays It makes calculations easier and
faster.

2. Calculators are used to everyone in daily life. A simple calculator can be made using
a C++ program which is able to add, subtract, multiply and divide, two operands
entered by the user.

3. The switch and break statement are used to create a calculator.

4. This program takes an arithmetic operator (+, -, *, /) and two operands from a user
and performs the operation on those two operands depending upon the operator
entered by the user.

5. A calculator is a portable device that helps to perform simple mathematical


calculations in our daily lives such as addition, subtraction, division, multiplication,
etc.

6. Some of the scientific calculators are used to perform complex calculation more
easily like square root, function, exponential operations, logarithm, trigonometric
function and hyperbolic function, etc.

7. In this section, we will create calculator program in C++ using function and do-
while loop.
INTRODUCTION

1. A calculator is a device that performs arithmetic operations on number. Basic calculator


can do only addition, subtraction, multiplication, division and other Mathematical
calculations.

2. the most basic calculator is the four-function calculator, which can perform basic
arithmetic such as addition, subtraction, multiplication and division. These are sometimes
called pocket calculators or hand-held electronic calculators because they are small enough to
fit in a shirt pocket.

3. We use a scientific or sophisticated calculator in some situations, where we need to solve


complex calculations like trigonometry functions, exponential operators, degrees, radians,
log functions, hyperbolic functions etc. Let’s discuss the various ways to create a
calculator program in the C++ language.

 Purpose: -
1. Calculators are simply a tool students use to help solve problems. Since they
eliminate tedious computations and algebraic manipulations that discourage many
students, calculators allow more students to solve problems and appreciate the power and
value of mathematics in the world today.

2. Basic calculators can do only addition, subtraction, multiplication and division


mathematical calculations. However, more sophisticated calculators can handle exponential
operations, square roots, logarithms, trigonometric functions and hyperbolic functions.

3. It is also a program on a computer that simulates a hand-held calculator. Calculator


programs let you perform simple math calculations .
PROJECT WORK

 Material: -

To understand this example, you should have the knowledge of the following C++
programming topics:

 C++ switch case Statement


 C++ break Statement
 C++ continue Statement

 Method: -
This program takes an operator and two operands from the user. The operator is stored
in variable op and two operands are stored in num1 and num2 .Respectively. Then, switch...case
statement is used for checking the operator entered by user. If user enters + then, statements for
case: '+' is executed and program is terminated. If user enters - then, statements for case: '-'
is executed and program is terminated. His program works similarly for the * and / operators.
But, if the operator doesn't matches any of the four character [+, -, * and /], the default statement
is executed which displays error message.
 Theoretical Background: -

*What is a calculator?

A calculator is a device that performs arithmetic operations on numbers. Basic calculators can
do only addition, subtraction, multiplication and division mathematical calculations. However,
more sophisticated calculators can handle exponential operations, square roots, logarithms,
trigonometric functions and hyperbolic functions. Internally, some calculators perform all these
functions by repeated addition processes. The evolution of the calculator Most calculators these days
require electricity to operate or are battery-powered calculators. Calculators work by
performing programmed functions based on numerical inputs. Before the electronic calculator
(circa 1970), a more primitive calculator, the slide rule, was commonly used. It consisted of a slat of
wood called the slide that could be moved in and out of a reinforced pair of slats. Both the slide and
the outer pair of slats had calibrated numerical scales.

* What are the benefits of using calculators?

This technology allows students solve complicated problems quickly and in an efficient
manner. Additionally, it can reduce the problem to simpler tasks and allows the student to devote
more time in understanding the problem. Secondly, they are saved from monotonous
calculations and the same boring mundane procedure

* What is the purpose of a variable in a calculator application?

Variables can be used in any equation and are substituted for their assigned value. Variables can
be inserted using the x button.

* What is the most important between a computer and a calculator?

A computer can perform any operation that a calculator is capable of performing, but a
calculator cannot carry out the logical and highly complex problems. The reason behind this is that
a computer can be programmed to make decisions, but a calculator is not equipped with that
technology.
ALGORITHUM

Step 1: Start

Step 2: The operator is stored in variable op and two operands are stored in num1 and num2
respectively.

Step 3: Then, switch...case statement is used for checking the operator entered by user.

Step 4: If user enters + then, statements for case: '+' is executed and program is terminated.

Step 5: If user enters - then, statements for case: '-' is executed and program is terminated.

Step 6: This program works similarly for the * and / operators. But, if the operator doesn't matches

any of the four character [ +, -, * and / ], the default statement is executed which displays error
message.

Step 7: End
Coding

#include<iostream.h>
#include<conio.h>
class super
{
char ch;
int a,b;
float val;
public:
super ()
{
cout<<"\nEnter Opration:";
cin>>ch;
cout<<"\nEnter two values";
cin>>a>>b;
}
void Cal()
{
if(ch =='+')
{
val = a+b;
cout<<"\nAddition is:"<<val;
}
else if(ch=='-')
{
val = a-b;
cout<<"\nSubtraction is:"<<val;
}
else if(ch =='/')
{
val = a/b;
cout<<"\nDivision is:"<<val;
}
else if(ch == '*')
{
val = a*b;
cout<<"\nMultiplication is:"<<val;
}
else if(ch == '%')
{
val = a%b;
cout<<"\nModulous is:"<<val;
}
}
};
void main()
{
clrscr();
char x;
do
{
super s;
s.cal();
cout<<"\nEnter N to exit Enter Y to continue:\n";
cin>>(x);
}while(x != 'n');
getch();
}

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