#include<string> #include<fstream> #include<iomanip> #include<cstdlib> using nam
ID: 3610045 • Letter: #
Question
#include<string>
#include<fstream>
#include<iomanip>
#include<cstdlib>
using namespacestd;
double WINDSPEED(doublei, doublek);
int main()
{
string filename;
ofstream KKK;
double windspeed;
int time, i, k;
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 (time=0; time<3601;time=time+10)
{
windspeed=WINDSPEED(i, k);
KKK << setw(8) << time <<setw(8) << windspeed << endl;
}
KKK.close();
system ("pause");
return 0;
}
double WINDSPEED(doublei, doublek)
{
return(((double)rand()/RAND_MAX)*(k-i)+i);
}
Explanation / Answer
please rate - thanks note the change of the variable name time to time1 #include #include #include #include #include #include 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 > filename; KKK.open(filename.c_str()); cout.setf(ios::dec); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.