Greetings;
I am trying to total up this operation but for some reason my calcu;ator isn't calculating. Does anyone know why? Does anyone know MVC++ really well. My question is how do you use the debugger to debug the program and watch the program you created step-by-step?
Here is my code
Code:#include <iostream> #include<string> #include <cassert> using namespace std; string apply(char operation); int factorial(int n); int op1, op2, total; char operation; int main() { cout << "Please enter: \n" << "+ to add two numbers;\n" << "- to subtract two numbers:\n" << "* multiply two numbers;\n" << "/ divide two numbers.\n"; cin >> op1 >> operation >> op2; total = operation; cout << op1 << operation << op2 << "=" << total <<endl; return 0; } string apply(char operation) { switch (operation) { case '+': "op1 + op2"; break; case '-': "op1 - op2"; break; case '*': "op1 * op2"; break; case '/': "op1 / op2"; break; default: cerr << "You selected an invalid operation!" << endl; return " "; } } \A work in progress... pay no attention \int factorial(int n) \{ \ assert( n >= 0); \ double product = 1; \ while ( n > 1 ) \ { \ product *= n; \ n--; \ } \return product; \}



LinkBack URL
About LinkBacks


