# C++ Program For Arithmetic Operations Using Switch Case

Problem:- C++ Program For Arithmetic Operations Using Switch Case or Write A C++ To Perform All Arithmetic Operations Using Switch Case or C++ Program to Make a Simple Calculator Using Switch Case Statement or c++ program to perform arithmetic operations using functions or simple calculator program in c++ or calculator program in c++ using class or c++ program for arithmetic operations using class or scientific calculator program in c++ using switch case or c++ program to perform arithmetic operations using objects and classes or calculator program in c++ using functions or simple calculator program in c++ or c program to perform arithmetic operations using functions

Check This:- Hacker rank solution for Strings, Classes, STL, Inheritance in C++.

Logic:- First we are printing the message on screen with 4 options then we are asking for choosing any one of option and after that take two Number form user and pass both number in Switch Case, first write all the cases(for Addition, Subtraction, Multiplication, Division and Mode) then write a code according to statement and execute the operation according to user choice. If you want to see more like this one see C Program To Find The Day Using Switch Case.

Also Check:- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard in C++.

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post or if you have any Query you can ask there with lots of coders also suggest to your Friends to join and like our page, so we can help our community, and don't forget to Subscribe. Enter your Email and click to subscribe.

Solution:-

#include<iostream>
using namespace std;
int main()
{
float a,b,rem;
int ch,q;

cout<<"Arithmetic Operatios";
cin>>ch;

switch(ch)
{
case 1:
{
cout<<"\nEnter Two Value Ie:- Value Of A And B ";
cin>>a>>b;
rem=a+b;
cout<<"\n  Result = "<<rem;
cout<<"\n";
}
break;

case 2:
{
cout<<"\nEnter Two Value Ie:- Value Of A And B";
cin>>a>>b;
rem=a-b;
cout<<"\n  Result = "<<rem;
cout<<"\n";
}
break;

case 3:
{
cout<<"\nEnter Two Value Ie:- Value Of A And B";
cin>>a>>b;
rem=a*b;
cout<<"\n  Result = "<<rem;
cout<<"\n";
}
break;

case 4:
{
cout<<"\nEnter Two Value Ie:- Value Of A And B";
cin>>a>>b;
if(a>=b)
{
rem=a/b;
cout<<"\n  Result = "<<rem;
cout<<"\n";
}
else
cout<<"\nt 1st Varable Should Be Greater Than 2nd.  !!!";
cout<<"\n";
}
break;

case 5:
{
cout<<"\nEnter Two Value Ie:- Value Of A And B";
cin>>a>>b;
if(a>=b)
{
q=a/b;
rem=a-(b*q);
cout<<"\n  Result = "<<rem;
cout<<"\n";
}
else
cout<<"\nt 1st Varable Should Be Greater Than 2nd.  !!!";
cout<<"\n";
}
break;
}

return 0;
}

Output:-

Previous Post
Next Post

#### post written by: Ghanendra Yadav

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.