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

Labassignment 2

Labassi
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)
8 views

Labassignment 2

Labassi
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/ 2

Name: Pallavi Parshuram Dhope

Roll No: 37

Assignment No: 02
Title: Write a C++ program create a calculator for an arithmetic operator (+, -, *, /). The program
should take two operands from user and performs the operation on those two operands depending
upon the operator entered by user. Use a switch statement to select the operation. Finally, display the
result

PROGRAM:

#include<iostream>

using namespace std;


int main()

float a, b;

char d;

cout<<"Enter the value of a "<<endl;

cin>>a;

cout<<"Enter the value of b"<<endl;

cin>>b;

cout<<"Enter the operation + , - , /,* : ";

cin>>d;

switch (d)

case '+':

cout<<"Addition is :"<< a+b;

break;

case '-':

cout<< "Subtraction is :"<< a-b;

break;

case '*':

cout<<"Multiplication is :"<< a*b;


break;

case '/':

cout<<"Division is :"<< a/b;

break;

default:

cout<<"Please enter correct operation ";

break;

return 0;

Output:

You might also like