Question
// ConsoleApplication66.cpp : Defines the entry point for the console application. // Flight simulator program #include stdafx.h #include #include #define RAND_MAX 32768 #define N 25
// ConsoleApplication66.cpp : Defines the entry point for the console application.
// Flight simulator program
#include "stdafx.h"
#include
#include
#define RAND_MAX 32768
#define N 25
int main()
{
unsigned int seed;
double aver_wind_speed, gusts;
double wind_speed_plus_gusts[N];
double rand_float(double a, double b);
int i;
printf("Enter the average wind speed: ");
scanf_s("%lf", &aver_wind_speed);
printf("Enter unsigned integer:");
scanf_s("%u", &seed);
srand(seed);
printf("Time \t Wind Speed ");
for (i = 0; i
gusts = rand_float(-2, 2);
/* if ((i >= 5 && i = 15 && i
else aver_wind_speed = 10; */ /* Include these two lines when you want to simulate wind speeds with storms */
wind_speed_plus_gusts[i] = aver_wind_speed + gusts; /* Windspeeds without storms, but having the normal
flight turbulence */
printf("%d \t %.2f ", i, wind_speed_plus_gusts[i]);
}
return 0;
}
double rand_float(double a, double b) {
return((double) rand() / RAND_MAX)*(b - a) + a;
}
Instructions: C++ a) Use scanf function to accept the input from the user. b) Use floating point inputs wherever possible c) All programs must use arrays and functions. d) Tabulate your results. e) Need hard copy of (i) source code and (ii) output for each program 1. Redo the flight simulator program (using functions) that we did in Lab 7. Plot the wind speed when (a) there is no storm, (b) when there are 3 storms with varying intensities. You can choose the time between which storms occurStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started