error no match for opperator >>

Write your question here.

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)) ===|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  #include <iostream>
#include <cmath>


using namespace std;
const float 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;
cin >> radius >> endl;
You can't use endl like that.
1
2
cin >> radius;
cout << endl;

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;.
Last edited on
Topic archived. No new replies allowed.