C++ Programming

Program to Convert the Temperature in Degree Celsius to Degree Fahrenheit

Write a Program to convert the temperature in degree Celsius to degree Fahrenheit and vice-versa using concept of class and object.

Source Code:


class Temp
               float f;
               float c;
               void read_c()
               void read_f()
               void write_c()
               void write_f()
               void c_to_f()
               void f_to_c()

void main()
       Temp t;
       int c;
       cout<<endl<<"Menu"<<endl<<"1. Convdert degree Celsius to Fahrenheit"
           <<endl<<"2. Convert degree Fahrenheit to Celsius"<<endl<<"3. Exit";
       cout<<endl<<"Enter your choice: ";        cin>>c;
               case 1:
                       cout<<endl<<"Enter temperature in degree Celsius: ";
                       cout<<"Equivalent temperature in degree Fahrenheit is: ";
               case 2:
                       cout<<endl<<"Enter temperature in degree Fahrenheit: ";
                       cout<<"Equivalent temperature in degree Celcius is: ";
               case 3:
                       cout<<endl<<"Invalid Choice!!!";
      } while(c!=3);

Back to top button