Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the windchill temperature example. Temperature (oF) Calm 40 35 30 25 20

ID: 671501 • Letter: C

Question

Consider the windchill temperature example. Temperature (oF) Calm 40 35 30 25 20 15 10 5 0 -5 -10 -15-20 25 30 -35 -40 -45 16 22 -28 -34 -40 -46 -52 -57 -63 5 10 15 20 25 E 30 2 35 S 40 45 50 36 31 25 19 13 7 -5 11 -1 34 27 21 15 93 4 -10 -16 -22 -28 -35 -41 -47 -53 -59 -66 -72 32 25 19 13 60713 30 24 17 11 4-2 9-15 29 23 16 9 34 11 -17-24 -31 -37 -44 -51 -58 -64 -71 -78 -84 28 22 15 8 1 5 12 28 21 14 707 -14 -2 13 19 -26 -32 -39 -45 -51 -58 -64 -71 -77 22 -29 -35 -42 -48 -55 -61 -68 -74 -81 24 17 11 4-2-915 19 -26 -33 -39 -46 -53 -60 -6773 -80 -87 21 -27 -34 -41 -48-55 -62 -69 76 -82 -89 27 20 13 6 -1 8 -15 -2 27 20 13 618 15-22 -29 -36 -43 -50 -57 -64 -71-78 -84 -91 26 19 12 5 -2 -9 -16 -2 23 -30 -37 -44 51 -58 -65 -72 -79 -86 -93 -24 -31 -38 -45-52 -60 -6774 -81 -88 95 26 19 12 4 -3 -10 -17 25 18 11 4 3-11 -18 -25 -32 -39 -46 -54 -61 -68 -75 -82 -89 -97 25 17 10 3 4 11 -19 -26 -33 -40 48 -55 -62 -69 76 -84 -91 -98 60 -11 -19 -26 -33 -40 -48 -55 -62 -69 -76 -84 -91 -98 Frostbite Times 1 30 minutes 10 minutes 5 minutes Wind Chill (F) 35.74+0.6215T-35.75(V0.15) +0.4275T(Vo.16) Where,T= AirTemperature (Vz Wind Speed (mph) Effective 11/01/01 Modify the given code appropriately, and using only four fprintf commands, generate a printed output that looks exactly as that shown below:

Explanation / Answer

#include <iostream>

using std::cout;

using std::endl;

using std::cin;

#include <cmath>

#include <iomanip>

using std::fixed;

using std::setprecision;

int windchill(double, double);

int main()

{

double wind, temp;

printf(“Please enter the wind speed: ");

scanf(“&wind”);

printf(“Please enter the temperature: ");

scanf(“&temp”);

while (temp>10)

{

printf(“The temperature should be less than 10. Try again: ");

scanf(“&temp”);

}

printf(“The wind chill index is : ",setprecision,fixed,windchill(wind,temp);

return 0;

}

int windchill(double v, double t)

{

int w;

w=33-(((10*sqrt(v)-v+10.5)*(33-t))/23.1;

return w;

}

Wind chill program asking user to enter values

#include <stdio.h>

// for pow(x,y)

#include <math.h>

int main()

{

      // v is wind speed in mph, t is temperature in Fahrenheit

      // and wci is wind chill index

      double v = 0.0, t = 0.0, wci = 0.0;

     

      // let provide a loop for continuous input until stopped by user

      while(v != -1)

      {

            // read and store v from user inputs

            printf("Enter wind speed in mph (-1 to stop): ");

            // the 3rd parameter of scanf_s() is not required for numerical, int and float

            // the lf is for double or long int, the l (el) is microsoft extension...

            scanf_s("%lf", & v, sizeof(double));

            // if user don't want to stop then repeat...

            if(v != -1)

            {

                  // read and store t from user inputs

                  // the 3rd parameter of scanf_s() is not required for numerical, int and float

                  printf("Enter temperature in Fahrenheit: ");

                  scanf_s("%lf", & t, sizeof(double));

                  // if (0 <= v <= 4)

                  if((v >= 0.0) && (v < =4.0))

                        wci = t;

                  // if (v >= 45)

                  else if (v >= 45)

                        wci = ((1.6*t) - 55);

                  // others...

                  else

                        wci = 91.4 + ((91.4 - t)*((0.0203*v) - (0.304*(pow(v,0.5))) - 0.474));

                  // print one of the result

                  printf(" For wind speed = %.2f and temperature = %.2f ", v, t);

                  printf("Wind Chill Index is: %.2f ", wci);

                  printf(" ");

            }

            // check the while loop condition

      }

      // if user press -1 for wind speed then stop...

      printf("This program was stopped by you. thank you! ");

      return 0;  

}