Advertisement
PuffySheep

Wind Chill

Oct 31st, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <math.h>
  4. using namespace std;
  5.  
  6. //Function prototypes
  7. float userInput();
  8. float windChill(float W, float T, float V);
  9. void header();
  10.  
  11.  
  12. //Function userInput
  13. //This function takes the input from the user
  14. float userInput()
  15. {
  16.     float W = 0, T = 0, V = 0;
  17.  
  18.     cout << "Please input the windspeed: ";
  19.     cin >> V;
  20.     cout << "Please input the temperature: ";
  21.     cin >> T;
  22. }
  23.  
  24. int main()
  25. {
  26.  
  27.     cout << "The windchill factor is: " << windChill(W) << endl;
  28.    
  29.     return 0;
  30. }
  31.  
  32. //Function header
  33. //This function outputs basic info to the user
  34. void header()
  35. {
  36.     cout << "Written by Andrew Brucks" << endl;
  37.     cout << "Lab 6 Part 3" << endl;
  38.     cout << "This program will analyze the input and output the windchill\n\n" << endl;
  39. }
  40.  
  41. //Function windChill
  42. //This function takes the inputted data and calculates the windchill
  43. float windChill(float W, float T, float V)
  44. {
  45.  
  46.     W = 35.74 + 0.6215 * T - 35.75 * pow(V, 0.16) + 0.4275 * T * pow(V, 0.16);
  47.  
  48.     return W;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement