Skip to content

a calculator with do operations like addition, subtraction, multiplication and division at the same time with same contants

Notifications You must be signed in to change notification settings

khushiyadav7305/calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

include

using namespace std;

int main() {

char op; float num1, num2;

cout << "Enter operator: +, -, *, /: "; cin >> op;

cout << "Enter two operands: "; cin >> num1 >> num2;

switch(op) {

case '+':
  cout << num1 << " + " << num2 << " = " << num1 + num2;
  break;

case '-':
  cout << num1 << " - " << num2 << " = " << num1 - num2;
  break;

case '*':
  cout << num1 << " * " << num2 << " = " << num1 * num2;
  break;

case '/':
  cout << num1 << " / " << num2 << " = " << num1 / num2;
  break;

default:
  // If the operator is other than +, -, * or /, error message is shown
  cout << "Error! operator is not correct";
  break;

}

return 0; }

About

a calculator with do operations like addition, subtraction, multiplication and division at the same time with same contants

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published