Hi, I'm workin on using a header file with 2 .cpp files to find the volume of a cylinder. Heres what I have for the header file.
Code:
class cylinder
{
private:
double r,l,v;
public:
double cylvol();
cylinder();
void get_data();
};
the name for the header file is cylinder.cpp
::this is cylinder.cpp::
Code:
#include "cylinder.h"
#include <iostream>
using namespace std;
void cylinder::get_data()
{
cout << "Please enter the radius and length of the Cylinder" << endl;
cin >> r >> l;
return;
};
double cylinder::cylvol()
{
const double PI = 3.14157;
v=PI*r*r*l;
return v;
};
cylinder::cylinder()
{
r = 0.0;
l = 0.0;
v = 0.0;
};
and last but not least the main program called foo.cpp
Code:
#include "cylinder.cpp"
int main()
{
cylinder junk;
junk.get_data();
cout << "The volume of the cylinder is: " << junk.cylvol() << endl;
return 0;
};
I get 3 link errors, please tell me what I'm doing wrong