here's my question here
Construct a class named Coord that contain two floating –point data member named xval and yval , which will be used to store the x and y values of a point in rectangular coordinates. The function member should include appropriate constructor and display functions and friend function named conv_pol (). The conv_pol() function should accept two floating point member that represent a point in polar coordinates and convert them into rectangular coordinates .
and here's my coding..
#include<iostream>
#include<cmath>
using namespace std;
class Coord
{
friend Coord conv_pol( float ,float);
private:
float xval;
float yval;
public:
void print();
Coord(float,float);
};
Coord::Coord(float x,float y)
{
xval = x;
yval = y;
}
void Coord::print()
{
cout<<'('<<xval<<','<<yval<<')'<<endl;
}
Coord conv_pol(float x,float y)
{
Coord temp;
temp.xval = temp.yval*cos(temp.yval*3.142 /180);
temp.yval = temp.yval*sin(temp.yval*3.142 /180);
return temp;
}
int main()
{
Coord a;
a=conv_pol(10,210);
a.print();
return 0;
}
the error says no appropriate default constructor not initialized but then.. have already done Coord(float,float) which is the default constructor..
can anyone help me here.