Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// 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

image text in transcribed

// 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 occur

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

=+How should we organize a book to maximize learning and interest

Answered: 1 week ago