The trouble is you think you have time. Your success depends on how you utilize your time.

C++ Program to Add, Subtract, Multiply , Divide and give Remainder to User by taking input.

Write a C++ program which takes input from the user and  Add, Subtract, Multiply , Divide and give Remainder to User . Make a Calculator in C++.

#include<iostream>
using namespace std;
int main(){
cout << "(www.moznum.blogspot.com)\n\n";
char x; double one, two;
cout << "For + press 1\n";
cout << "For - press 2\n";
cout << "For x press 3\n";
cout << "For / press 4\n";
cout << "For Remainder press 5\n";
cout << "\nThe Value You Entered Is = ";
cin >> x;

switch (x){
case '1':
cout << "\nEnter 1st value to + : ";
cin >> one;
cout << "\nEnter 2nd value to + : ";

cin >> two;
cout << "\nYour Sum of " << one << " and " << two << " is " << one + two << "\n";
cout << one << " + " << two << " = " << one + two << "\n";
break;

case '2':
cout << "\nEnter 1st value to - : ";
cin >> one;
cout << "\nEnter 2nd value to - : ";
cin >> two;
cout << "\nYour Subtraction of " << one << " and " << two << " is " << one - two << "\n";
cout << one << " - " << two << " = " << one - two << "\n";
break;

case '3':
cout << "\nEnter 1st value to x : ";
cin >> one;
cout << "\nEnter 2nd value to x : ";
cin >> two;
cout << "\nYour Multiplicaion of " << one << " and " << two << " is " << one * two << "\n";
cout << one << " x " << two << " = " << one * two << "\n";
break;

case '4':
cout << "\nEnter 1st value to Divide: ";
cin >> one;
cout << "\nEnter 2nd value to Divide: ";
cin >> two;
cout << "\nYour Division of " << one << " and " << two << " is " << one / two << "\n";
cout << one << " / " << two << " = " << one / two << "\n";
break;

case '5':
int one, two;
cout << "\nEnter 1st value for Modulus/Remainder: ";
cin >> one;
cout << "\nEnter 2nd value for Modulus/Remainder: ";
cin >> two;
cout << "\nYour Remender of " << one << " and " << two << " is " << one % two << "\n";
cout << one << " % " << two << " = " << one % two << "\n";
break;

default:
cout << "Your Input Is Wrong\n\n";
break;
}
cout << "\n\n";
}

You can also search this topic by:
How to make a Calculator in C plus plus which  Add, Subtract, Multiply , Divide and give Remainder as output.
How to  Add, Subtract, Multiply , Divide and take Remainder of two numbers in c++.

No comments:

Post a Comment