Hello, noob here. Been trying to make a calculator but i keep getting the same error (Error: expected ':' before cout). This is reported on the switch section. I am using Code Blocks
Near the bottom there is the switch statement, always look up the documentation for the things you are using.
main must return an int:
1 2 3
int main() {
}
Always initialise your variables to something.
When doing division (you aren't - that's a clue to another problem) , always check for division by zero. It looks like this for a double value:
1 2 3 4 5 6 7 8
constant double PRECISION = 1 e-5; // set this to whatever suits you
double a = 0.0; // 1 variable per line, initilised
double b = 0.0;
// get input
if (b < PRECISION) {std::cout << "B is near enough to zero\n";}
else {double answer = a / b;}
Here's a clue how to discover problems - use the compiler with all the warnings turned on. Try cpp.sh (the gear icon top right of the code) turn on all 3 warnings on the options tab
Actually the error is not that weird. Keep in mind that an error reported on one is most often on the line above. Hint "default" comes the closest to being written correctly, but even it is wrong.
As the TheIdeasMan said use the gear icon in the top right corner of your code. The errors that are returned are very good.