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

Hello, myalgorithm prints out a data file with random wind speeds through aperio

ID: 3610196 • Letter: H

Question

Hello, myalgorithm prints out a data file with random wind speeds through aperiod of 3600 seconds, I need help adding a few lines thatwill add a 0.5% possibility of encountering a small storm,therefore increasing the wind speed by 10 MPH for a period of 300secs. Thanks.
#include<iostream>
#include<string>
#include<fstream>
#include<iomanip>
#include<cstdlib>
#include<time.h>

using namespace std;

double WINDSPEED (double i,double k);

int main()
{
string filename;
ofstream KKK;
double windspeed;

int time1, i, k;
unsigned seed=time(0);
srand(seed);
i=8;
k=12;
cout << "Please enter the filename for output: ";
cin >> filename;

KKK.open(filename.c_str());
cout.setf(ios::dec);
cout << fixed << setprecision(4);

for (time1=0;time1<3601; time1=time1+10)
{
windspeed=WINDSPEED(i, k);
KKK << setw(8) << time1<< setw(8) << windspeed << endl;
}

KKK.close();
system ("pause");
return 0;
}
double WINDSPEED (double i, doublek)
{
return(((double) rand()/RAND_MAX)*(k-i)+i);
} Hello, myalgorithm prints out a data file with random wind speeds through aperiod of 3600 seconds, I need help adding a few lines thatwill add a 0.5% possibility of encountering a small storm,therefore increasing the wind speed by 10 MPH for a period of 300secs. Thanks.
#include<iostream>
#include<string>
#include<fstream>
#include<iomanip>
#include<cstdlib>
#include<time.h>

using namespace std;

double WINDSPEED (double i,double k);

int main()
{
string filename;
ofstream KKK;
double windspeed;

int time1, i, k;
unsigned seed=time(0);
srand(seed);
i=8;
k=12;
cout << "Please enter the filename for output: ";
cin >> filename;

KKK.open(filename.c_str());
cout.setf(ios::dec);
cout << fixed << setprecision(4);

for (time1=0;time1<3601; time1=time1+10)
{
windspeed=WINDSPEED(i, k);
KKK << setw(8) << time1<< setw(8) << windspeed << endl;
}

KKK.close();
system ("pause");
return 0;
}
double WINDSPEED (double i, doublek)
{
return(((double) rand()/RAND_MAX)*(k-i)+i);
}

Explanation / Answer

please rate - thanks added the red code -(I think I highlighted itall!) #include #include #include #include #include #include using namespace std; double WINDSPEED (double i, double k); int main() { string filename; ofstream KKK; double windspeed; bool storming=false; int time1, i, k,storm,stoptime=-1; unsigned seed=time(0); srand(seed); i=8; k=12; cout > filename; KKK.open(filename.c_str()); cout.setf(ios::dec); cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote