C and C++

Program to converting degree to radian using type conversion

#include<iostream.h>
class degree
{
private:
float angle, f, t, d, r;
public:
degree();
float radian();
void disp();
};
degree::degree()
{
cout<<"Enter the angle in degree: "; cin>>angle;
}
float degree::radian()
{
const float PIE=3.142857;
r = angle*PIE/180;
return r;
}
void main()
{
float p,x,z;
degree a;
p = a.radian();
cout<<"Angle in radian is: "<<p<<endl;
}

[wp_ad_camp_1]

OUTPUT
Enter the angle in degree: 90
Angle in radian is: 1.571429

Leave a comment

Your email address will not be published. Required fields are marked *