Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ----HEADER START----
- Author: Chris Reed
- UNCC ID: 800770336
- Course Name: ECGR-2103
- Assignment Number: 3 -- Ch. 3 Problem 7
- Description: (Brief description of what the program does)
- Calculates wind chill index using a function.
- ----HEADER END----
- */
- #include <iostream>
- #include <cmath>
- using namespace std;
- float windChillIndex(float windSpeed,float temperature); // declare function
- int main()
- {
- // declaring variables
- float windSpeedInput;
- float temperatureInput;
- float windChillIndexOutput;
- cout << "What is the wind speed in meters per second? ";
- cin >> windSpeedInput;
- cout << "What is the temperature in degrees Celsius? ";
- cin >> temperatureInput;
- // calling function
- windChillIndexOutput = windChillIndex(windSpeedInput,temperatureInput);
- cout << "The wind chill index in degrees Celsius is " << windChillIndexOutput << ".\n";
- return 0;
- }
- float windChillIndex(float windSpeed,float temperature)
- {
- // calculating wind chill index
- return 33 - ((10 * sqrt(windSpeed) - windSpeed + 10.5) * (33 - temperature)) / 23.1;
- }
Add Comment
Please, Sign In to add comment