I dont know what to do with the second part of the question. Can anyone please h
ID: 3626644 • Letter: I
Question
I dont know what to do with the second part of the question. Can anyone please help me finish the program?Assume that we want to the flight simulator wind data to include a .5%possibility of encountering a small storm at each time step. Therefore, modify the solution to the above problem so that the average wind speed is increased by 10mph for a period 5 minutes when a storm is encountered.
#include<iostream>
#include<cstdlib>
#include<ctime>
#include<fstream>
#include<iomanip>
using namespace std;
double windspeed( double a, double b);
int main()
{
ofstream outfile;
srand(time(NULL));
outfile.open("wind");
cout<<setw(15)<<"Time(sec)"<<setw(15)<<"Windspeed(mph)"<<endl;
outfile<<setw(15)<<"Time(sec)"<<setw(15)<<"Windspeed(mph)"<<endl;
for (int t=0; t<3601; t=t+10)
{
if( )
//storm
{
}
else
//normal windspeed
{
cout<<setw(15)<<t<<setw(15)<<windspeed(8,12)<<endl;
outfile<<setw(15)<<t<<setw(15)<<windspeed(8,12)<<endl;
}
}
system("pause");
return 0;
}
double windspeed( double a, double b)
{
return ( (double)rand()/RAND_MAX)*(b-a)+a;
}
Explanation / Answer
u can increment the wind speed in a loop while(storm!=0)//while the storm still moving or something { minute_counter++; if(minute_counter == (5*60) { windspeed=windspeed+10; minute_counter=0; } } this is how u should do it if u can figure out a way to know how to calculate the regular wind speed and when there is a storm maybe i can help u out more if u have more information about the question message me with it
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.