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

Computer Project Work

Uploaded by

dadu27973
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)
44 views

Computer Project Work

Uploaded by

dadu27973
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/ 13

Topic –“ Project Report on Bank database using

MySQL”

Submitted To :- Submitted by : -

Supriya Mahanta Name :


Class :
Roll no :
CERTIFICATE
This is to certify that …………………, a student of class XII, has successfully
completed the research on the on the topic “ Calculator implemented
using c++ programming ” project under the guidance during the session
2024-25.Thisis accord of original project work done by me under the
guidance and supervision of Supriya Mahanta Faculty of Computer
Science Department , Brilliance Academy ,Further certify that -

1. The work contained report is original and done under the general
supervision of of my Faculty .

2. The work has not been submitted to any other Institution for class XII
Senior Secondary Examination , AHSEC Board.
INTRODUCTION

Accordingly , this project aims to develop source code in the form of a


computer program i.e, c++ that a General Calcalutor could use to compute
functions such as addition , multiplication , substraction and division.The idea
of this project is that –

1. Since the mathematical function such as addition , substraction,


etc.So this functions are define in the library function of
<math.h>,Thus we have return the value of the function to call
function.
2. For menu driven program , here we have to use switch-case
statement.

The code of the calculator application mainly comprise the standard calculator.
The standard calculator class helps to perform standard calculation.This
contains static function so as to ensure that these function can be called in the
main function through class name.
LOGIC OF THE PROJECT
PROJECT
Creating the standard calculator :

The standard class aims at performing specific task related to standard calculation.These
task are : -

 Adding of two numbers or more.


 Substracting the second number from the first number
 Multiplying two or more numbers .
 Divinding the first number from the second number.

To perform the above mentioned task , the standard calculator class implements the
following member function .

FUNCTION Description
Addition Returns the sum of two or more numbers

Substraction Returns the substraction of two numbers

Multiplication Returns multiplication of two or more numbers.

Division Returns the output obtained after performing


Operation on the input number
SOURCE CODE OF STANDARD
CALCULATOR IN C++

#include <iostream>

#include <vector>

using namespace std;

double add(const vector<double>& numbers) {

double sum = 0;

for (double num : numbers) {

sum += num;

return sum;

double subtract(const vector<double>& numbers) {

double result = numbers[0];

for (size_t i = 1; i < numbers.size(); ++i) {

result -= numbers[i];

return result;

double multiply(const vector<double>& numbers) {

double product = 1;

for (double num : numbers) {

product *= num;

return product;

}
double divide(const vector<double>& numbers) {

double result = numbers[0];

for (size_t i = 1; i < numbers.size(); ++i) {

if (numbers[i] == 0) {

throw runtime_error("Error: Division by zero.");

result /= numbers[i];

return result;

int main() {

char operation;

int count;

vector<double> numbers;

cout << "Enter the number of operands: ";

cin >> count;

cout << "Enter the numbers: ";

for (int i = 0; i < count; ++i) {

double num;

cin >> num;

numbers.push_back(num);

cout << "Enter an operator (+, -, *, /): ";

cin >> operation;

try {

switch (operation) {

case '+':

cout << "Result: " << add(numbers) << endl;


break;

case '-':

cout << "Result: " << subtract(numbers) << endl;

break;

case '*':

cout << "Result: " << multiply(numbers) << endl;

break;

case '/':

cout << "Result: " << divide(numbers) << endl;

break;

default:

cout << "Invalid operator." << endl;

} catch (const runtime_error& e) {

cout << e.what() << endl;

return 0;

OUTPUT SCREEN
Main screen : -
CHOOSE THE NUMBER OF OPERANDS
Acknowledgment
I would like to express my sincere gratitude to everyone who contributed to the
successful completion of this project. I am deeply thankful to my Mentor,
Supriya Mahanta , for their invaluable guidance, insightful feedback, and
continuous support throughout the course of this project. Their expertise and
encouragement greatly contributed to shaping this work.

I also extend my appreciation to my colleagues and peers for their assistance,


discussions, and collaboration, which have been instrumental in the
development of this project.

Finally, I would like to acknowledge the resources and support provided by


Brilliance Academy , which played a crucial role in the completion of this work.

Thank you.

You might also like