Guest User

Untitled

a guest
Dec 14th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. /* ----HEADER START----
  2. Author: Chris Reed
  3. UNCC ID: 800770336
  4. Course Name: ECGR-2103
  5. Assignment Number: 3 -- Ch. 3 Problem 7
  6. Description: (Brief description of what the program does)
  7. Calculates wind chill index using a function.
  8. ----HEADER END----
  9. */
  10.  
  11. #include <iostream>
  12. #include <cmath>
  13.  
  14. using namespace std;
  15.  
  16. float windChillIndex(float windSpeed,float temperature); // declare function
  17.  
  18. int main()
  19. {
  20. // declaring variables
  21. float windSpeedInput;
  22. float temperatureInput;
  23. float windChillIndexOutput;
  24.  
  25. cout << "What is the wind speed in meters per second? ";
  26. cin >> windSpeedInput;
  27.  
  28. cout << "What is the temperature in degrees Celsius? ";
  29. cin >> temperatureInput;
  30.  
  31. // calling function
  32. windChillIndexOutput = windChillIndex(windSpeedInput,temperatureInput);
  33.  
  34. cout << "The wind chill index in degrees Celsius is " << windChillIndexOutput << ".\n";
  35.  
  36. return 0;
  37. }
  38.  
  39. float windChillIndex(float windSpeed,float temperature)
  40. {
  41. // calculating wind chill index
  42. return 33 - ((10 * sqrt(windSpeed) - windSpeed + 10.5) * (33 - temperature)) / 23.1;
  43. }
Add Comment
Please, Sign In to add comment