C++ Programming

Program to Convert the Temperature in Degree Celsius to Degree Fahrenheit

Convert the Temperature

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);



About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.

You may also like

program to find leap year
C++ Programming

C++ Program to Find Leap Year by Using Function

  • March 3, 2016
Write a program to find if the inputted year is a leap year or not by using the concept of