Hello all,

I have tried unsuccessfully to create program using a header file, implemenation file, document file, and driver program that compute the area of a circle given only the radius. I was told to use the header file for the function header only and the implementation file for the actual code. Can someone explain to me what I did wrong. Here is the code;

header file.h

implementation file.cppCode:/* area.h provides an interface for a library of the area of a circle. ***************************************************************/ #include <cmath> #include <iostream> const double PI = 3.14159; double radius; double area(double radius, const double PI) { return PI * pow(radius, 2); }

driverCode:/* area.cpp converts a given radius of a circle to the area of a circle. * using function area() that is stored in the library area. * * Input: Radius of a circle * Output: Area of a circle **************************************************************/ #include <iostream> using namespace std; #include "area.h" #include <cmath> int main() { double radius, area1; cout << "This program converts a given radius of a circle\n" << "to the area of a circle.\n"; cout << "\nEnter the length of your radius: "; cin >> radius; area1 = area(radius,PI); cout << "A radius length of: " << radius <<"," << "\nusing the correct equation converts to an area of: " << area1 << endl; }

It works the way that I made it, however, i was told to I was told to use the header file for the function header only and the implementation file for the actual code. I am lost.Code:/*driver.cpp test the functions and constants in area.h . * *********************************************************/ #include<iostream> using namespace std; #include "area.h" #include <cmath> double area(double radius, const double PI); int main() { cout << "2 => " << area(2, PI) << "\n"; cout << "4 => " << area(4, PI) <<"\n"; }