There are two obvious errors, and a few other issues too.
One, a variable called
choices
is declared, and later
choice
is referred to. Note the difference in spelling, it needs to be the same in both cases.
The other issue is, main() ends with the closing brace '}' at line 18.
Then after that, there is some additional code which isn't part of main, or any other function.
So, move lines 17 and 18
and put them right at the end, after line 41.
A few other issues.
The standard libraries should be:
1 2
|
#include <iostream>
#include <cmath>
|
without the .h suffix. Note that when you do this, you will need to do something like
using namespace std;
at the top of the program, before the start of main(), or use the prefix
std::
for names like
std::cin
and
std::endl
Back to the code. You defined at line 7
int radius, diameter, area;
and then later defined them again as type float at line 23. In this case the compiler will accept this, but it is pointless, as one set of variables hide the others. Also it is better to define pi just once as a constant, rather than typing its value directly into each expression.
const double pi = 3.1415926535897932385;
Note, I would recommend the use of
double
rather than
float
as a matter of routine, because of its higher precision.
As well as that, there is the use of
clrscr()
which is non-standard, but more to the point, at line 39 it will mean your output is cleared before you get a chance to read it.