diff --git a/exercises/calculator.cpp b/exercises/calculator.cpp index 013cc786..0185d9f3 100644 --- a/exercises/calculator.cpp +++ b/exercises/calculator.cpp @@ -1,12 +1,49 @@ /* - Write a program that given two numbers as input make the main operations. + Write a program that given two numbers as input make the main operations. - Output: - Insert first number: 4 - Insert second number: 2 + Output: + Insert first number: 4 + Insert second number: 2 - SUM: 6 - Difference: 2 - Multiplication: 8 - Division: 2 + SUM: 6 + Difference: 2 + Multiplication: 8 + Division: 2 */ +#include + +using namespace std; + +int main(){ + int num1; + int num2; + + cout<< "Insert first number: "; + cin >> num1; + + if(cin.fail()){ + cerr<<"Error: The given value is not a number"<> num2; + + if(cin.fail()){ + cerr<< "Error: The given value is not a number"<