The are two errors (compile time errors, at least). First of all, cin
, cout
and endl
are not known, you have to write them as std::cin
, std::cout
and std::endl
.
The second problem is here:
switch (choice);
Remove that semicolon and it’s fine. The reson why it’s not working with the semicolon is because then switch (choice);
is its own one and done deal, and the statements after it don’t make sense without it.
Also, although it’s not causing any compile time errors, I would highly recommend that you indent your code properly. mjcs edited the code you provided for you, it now looks much nicer and it is much easier to find the errors this way. In a big program, it is absolutely vital that the code is indented well, otherwise it’s very hard to work with.
2
solved Calculator Program does not compile [closed]