Help me :x

i'm getting error: statement cannot resolve address of overloaded function in the line 10, and i dont know why ...

#include <iostream>
#include <cmath>
using namespace std;

int main ()

{
float r, c, a, v;

cout << "Raio: "; endl;
cin >> r;

c = 2 * M_PI * r;
a = M_PI * pow(r,2);
v = 3/4 * M_PI * pow(r,3);

cout << "Valor do comprimento: " << c << endl;
cout << "Valor da area: " << a << endl;
cout << "Valor do volume: " << v << endl;
}


thankss
cout << "Raio: " << endl;

Also - Add M_PI to your declaration of variables:
 
float r, c, a, v, M_PI;
Last edited on
closed account (28poGNh0)
@rcast

"Also - Add M_PI to your declaration of variables:"

M_PI is constante defined in math.h header as follow
#define M_PI 3.14159265358979323846
so no need to declare it

@webbru

you can do as rcast montion cout << "Raio: " << endl;

and you should notice that the v always takes the value 0

your program need to be like this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# include <iostream>
# include <math.h>
using namespace std;

int main ()
{
    float r, c, a, v;

    cout << "Raio: " << endl;
    cin >> r;

    c = 2 * M_PI * r;
    a = M_PI * pow(r,2);
    v = ((float)a/4)* M_PI * pow(r,3);

    cout << "Valor do comprimento: " << c << endl;
    cout << "Valor da area: " << a << endl;
    cout << "Valor do volume: " << v << endl;
}

Good to know, ty
@techno1

thank you, man, works!
Topic archived. No new replies allowed.