C++ Program to Convert Degree to Radian & Vice-Versa

Write a program that convert degree to radian & vice-versa using the basic concept degree to radian & vice-versa using the concept of object & class. Make separate class for degree and radian which will have the private member to hold the value & make conversion function in each class for conversion from one to another.
- Program to Swap Two Numbers Without Using Temporary Variable
- Program to Implement the Concept of a Stack Using Class and Object
- C++ Program to a Number is Prime or Not
- Program to Calculate the Factorial Using Recursion
- C++ – Input Character and Display Vowel or Not
Source Code
#include<iostream> #include<conio.h> #define PI 3.1415 using namespace std; class degree { float d,r; public: void get_data() { cout<<"Enter the value in degree:"; cin>>d; } void show_data() { r=d*(PI/180); cout<<"the equivalent value in radian is: "<<r<<endl;; } }; class radian { float r,d; public: void get_data() { cout<<"Enter the value in radian:"; cin>>r; } void show_data() { d=r*(180/PI); cout<<"the equivalent value in degree is:"<<d<<endl; } } ; int main() { degree d; d.get_data(); d.show_data(); radian r; r.get_data(); r.show_data(); }