Ya it's pretty much completely wrong. Wrong in the sense of what I meant and wrong in the sense of actual code.
Code:
cout<< 32 * 7 + 99 / 3 - 256=apple<<"the answer is" apple endl;
This is just way wrong....
You never used string so you don't need to include it, you didn't actually create a scope ({}), and if you're just trying to cout the value of an equation you don't need a variable, and C++ will do order of precedence but it would be in better practice, since it's a little bit longer equation, to actually do it yourself ((32 * 7) + (99 / 3)) - 256.
I did mean it as user input.
It's easy to just
Code:
cout << "First number "; cin >> firstNum
cout << "Second number "; cin >> secondNum;
cout << "Operator "; cin >> _operator;
cout << doMath(firstNum, secondNum, _operator) << endl;
Instead
Code:
cout << "Equation "; cin >> equation;
cout << doMath(equation);
- - - Updated - - -
And @
Synator, that is probably the most worthless post I have seen in the past few weeks and even more useless in this topic....
- Code Academy is mostly web development markups (HTML, JSS, PHP). It does not offer anything on C or C++, let alone any .net
- Python is a fantastic language for anything web based... I've even seen people compare Python to HTML5. Hell, youtube, google, instagram, reddit, spotify, and many other sites are written in Python
- Advanced tools can be written in any language you want. *As long as you can figure out how to do it.
- You didn't even talk about learning to become a "hacker". You give poor advice on learning to code....