#include<iostream> #include<cstdlib> #include<ctime> #include<fstream> #include<
ID: 3626528 • Letter: #
Question
#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
That looks good as far as I can tell!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.