Does Anyone Know Why This Code Is Printing The Number Ten??
I'm having an issue with making a calculator in C++. The calculator itself is working, however, after the calculation, the program prints the number ten to the screen and I have no idea why. Can someone help me out? #include <iostream> using namespace std; int calculator(){ int a, b; char op; cout << "Enter Operator, Either +, -, *, or /: "; cin >> op; cout << "Enter Two Numbers: "; cin >> a >> b; switch (op) { case '*': cout << a * b << endl; cin.get(); break; case '/': cout << a / b << endl; cin.get(); break; case '+': cout << a + b << endl; cin.get(); break; case '-': cout << a - b << endl; cin.get(); break; } } int factorial(int n){ if (n==1){ return 1; } else { return n * factorial (n-1); } } int main() { cout << calculator(); cout << endl; cout << factorial(4); return 0; }