I cannot compile this very basic code. It computes the outside of a circle.
Here is the error
||=== Build: Debug in geometry_circumforence (compiler: GNU GCC Compiler) ===|
C:\Program Files\CodeBlocks\share\CodeBlocks\geometry_circumforence\circ.cpp||In function 'int main()':|
C:\Program Files\CodeBlocks\share\CodeBlocks\geometry_circumforence\circ.cpp|23|error: 'Circ' was not declared in this scope|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 4 second(s)) ===|
#include <iostream>
#include <cmath>
usingnamespace std;
constfloat PI = 3.14;
float circ; //circumference.
float radius;
int main() {
circ = PI * sqrt(radius);
cout << "This is a simple math equation that circumference the area of a circle/d" << endl;
cout <<"" << endl;
cout <<" What is the radius of a circle circle/" << endl;
cin >> radius >> endl;
cout << "The circumference of circle is " << Circ << endl;
return 0;
Hello there!
I compiled your code and got 3 errors and i've debugged them,
1) in line 20 cin >> radius >> endl; you can't use endl in cin
2) in line 22 cout << "The circumference of circle is " << Circ << endl; you have used Circ instead of circ
3) you have forgot to close the main() function
other than these three everything else seems good!
hope this helps.
Also a logical error, you have to compute the data after you take the input
i.e circ = PI * sqrt(radius); must come after cin >> radius;.