1. //
  2. // Program to convert temperature from Celsius degree
  3. // units into Fahrenheit degree units:
  4. // Fahrenheit = Celsius * (212 - 32)/100 + 32
  5. //
  6. #include <cstdio>
  7. #include <cstdlib>
  8. #include <iostream>
  9. using namespace std;
  10. int main(int nNumberofArgs, constchar* pszArgs[])
  11. {
  12. // enter the temperature in Celsius
  13. int celsius;
  14. cout << 'Enter the temperature';
  15. cin >> celsius;
  16. // calculate conversion factor for Celsius
  17. // to Fahrenheit
  18. int factor;
  19. factor = 212 - 32;
  20. // use conversion factor to convert Celsius
  21. // into Fahrenheit values
  22. int fahrenheit;
  23. fahrenheit = factor * celsius/100 + 32;
  24. // output the results (followed by a NewLine)
  25. cout << 'value is';
  26. cout << fahrenheit << endl;
  27. // wait until user is ready before terminating program
  28. // to allow the user to see the program results
  29. system('PAUSE');
  30. return 0;
  31. }
  32.