C++ - Programming Language
This course covers the basics of programming in C++. Work your way through the videos/articles and I'll teach you everything you need to know to start your programming journey!

Calculator

Lesson 18
Author : 🦒
Last Updated : November, 2017


Code

Copyint num1, num2;
char op;

cout << "Enter num1: ";
cin >> num1;

cout << "Enter Operator: ";
cin >> op;

cout << "Enter num2: ";
cin >> num2;

if(op == '+'){
     cout << num1 + num2 << endl;
} else if(op == '-'){
     cout << num1 - num2 << endl;
} else if(op == '/'){
     cout << num1 / num2 << endl;
} else if(op == '*'){
     cout << num1 * num2 << endl;
} else {
     cout << "Invalid Operator" << endl;
}