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

#include<iostream> #include<cstdlib> #include<fstream> using namespace std; doub

ID: 3617866 • Letter: #

Question

#include<iostream>

#include<cstdlib>

#include<fstream>

using namespace std;

double wind(double a, doubleb);

int main()

{

    ofstreamOOO;

    doubley1, y2, withstorm, withoutstorm, storm;

    int time,tstorm, seed;

   OOO.open("wind.dat");

    cout<<"Please enter the range of the windspeed;starting with thehighest number: "<<endl;

    cin>> y1>>y2;

    cout<<"Please enter speed"<<endl; // random numbers cambiende table

    cin>> seed;

   srand(seed);

   OOO<<"Time(sec)"<<" Wind(mph) "<<endl;

for(time=0; time<=3600;time=time+10)

    {

        storm=wind(0,100);

       

   if(storm<=0.5)

        {

           for (int v=0; v<=300; v=v+10)

           {

               tstorm=time+v; // we use this to increase each storm by 10

               withstorm=wind(y2+10, y1+10); // range increase por el storm

               OOO<<" "<<tstorm<<" "<<withstorm<<" *"<<endl;

               cout<<" "<<tstorm<<" "<<withstorm<<" *"<<endl;

           }

           time=time+300; // for every 300 seconds.. comenzar de la ultimatormenta

        }

    else

        {

           withoutstorm=wind(y2,y1);

           OOO<<" "<<time<<" "<<withoutstorm<<endl;

           cout<<" "<<time<<" "<<withoutstorm<<endl;

        }

}

   OOO.close();

    system("pause");

    return0;

}

double wind(double a, doubleb)

{

    doublex;

   x=((double) rand()/(RAND_MAX))*(b-a)+a;

    returnx;

Explanation / Answer

#include<iostream>

#include<cstdlib>

#include<fstream>

using namespace std;

double wind(double a, double b);

int main()


    ofstreamOOO;                                            

double y1, y2, withstorm, withoutstorm, storm;

int time, tstorm, seed;

    cout <<"Please enterseed"<<endl; // random numbers cambien detable

   srand(seed);         //seed random number generator

   if(storm<=0.5)                                                           //if the speed <.5

        { for (int v=0;v<=300;v=v+10)                             //for 5 minutes-in 10 second increment

               withstorm=wind(y2+10,y1+10);                      // range increase por el storm

               cout<<" "<<tstorm<<" "<<withstorm<<" *"<<endl;

        }

       {

           OOO<<" "<<time<<" "<<withoutstorm<<endl;

        }

   OOO.close();               //close output file

    system ("pause");

    return 0;

}

{                                                                            //create wind speed between the range a & b

   x=((double) rand()/(RAND_MAX))*(b-a)+a;