Friday, March 16, 2018

Temperature Converter Using Function in C++


In this article I would like to share with you a sample program that I wrote using C++ to demonstrate how to use function to convert temperature the code is very easy to understand to use.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.




Sample Program Output


Program Listing


temp.cpp


#include <iostream>
#include <iomanip>

using namespace std;

     float Convert(float);
    int main()
     {
       float TempFer=0.00;
       float TempCel=0.00;
       cout << std::fixed;
       cout << std::setprecision(2);
   cout << "Temperature Converter Using Function in C++";
   cout << "\n\n";
   cout << "Created By Mr. Jake R. Pomperada, MAED-IT";
   cout << "\n\n";
       cout << "Enter temperature in Fahrenheit: ";
       cin >> TempFer;
       TempCel = Convert(TempFer);
       cout << "\nHere's the temperature in Celsius: ";
       cout << TempCel;
   cout << "\n\n";
   cout << " End of Program ";    
     }

    float Convert(float Fer)
     {
        float Cel;
        Cel = ((Fer - 32) * 5) / 9;
        return Cel;
   }

No comments:

Post a Comment