calculating area of a circle using user-defined function
Hi :)
I'm getting this error:
error: void value not ignored as it ought to be
Could you please tell me the reason for this? Do you find my code correct? Any suggestion? Please help me. Thanks.
Code:
// calculating area of a circle using user-defined function
#include <iostream>
#include <cstdlib>
using namespace std;
void area(float);
int main()
{
float r; float a;
cout << "enter radius: "; cin >> r;
a = area(r);
cout << a;
return 0;
system("pause");
}
//------------------------------------
// area(int), function definition
void area(float v)
{
float a;
a = 3.1416*(v*v);
}
//--------------------------------------
error: void value not ignored as it ought to be|