Jump to content
slacker

Temperature converter

Recommended Posts

// Conversion - Program to convert temperature from Celcius Degrees into Fahrenheit:
// Fahrenheit = Celcius * (212 -32)/100 + 32
#include
#include
#include

using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
// enter the temperature in Celsius
int celcius;
cout << "Enter the Temperature in Celsius:";
cin >> celcius;

//calculate conversion factor for Celsius
// to fahrenheit
int factor;
factor = 212 - 32;

// use conversion factor to convert Celcius
// into fahrenheit values
int fahrenheit;
fahrenheit = factor * celcius/100 + 32;

// output the results (followed by a Newline)

cout << "Fahrenheit value is:";
cout << fahrenheit << endl;

// wait untul user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}

Edited by slacker
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...