C++ Function Definition calculate area of circle

Description

C++ Function Definition calculate area of circle

#include <iostream>
using namespace std;
float circarea(float radius);
int main()//from   ww w .  j a va2s .com
{
   double rad;
   cout << "\nEnter radius of circle: ";
   cin >> rad;
   cout << "Area is " << circarea(rad) << endl;
   return 0;
}
float circarea(float r)
{
   const float PI = 3.14159F;
   return r * r * PI;
}



PreviousNext

Related