Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Using C++ code, make a program named q6.cpp that uses 3 functions named spawn, adjust and dump to create, scale and print the elements

1. Using C++ code, make a program named q6.cpp that uses 3 functions named spawn, adjust and dump to create, scale and print the elements of an n-element array A of real values. The function named spawn receives, as parameters, A and n, from the function named main and assigns to each of the even-indexed and odd-indexed elements of A random integers in the ranges [100, 2672] and [260, 1988], respectively. The function named adjust receives, as parameters, A and n, from the function named main, generates a random integer b in the range [14, 27] and divides each element of A that is in the range [500, 1700] by b. If a resulting element (after division by b) is less than 0.25, then it is replaced by -1. The function named dump, receives, as parameters, A and n, from the function named main and prints the elements of A.

And

2. Using C++ code, make a program named q7.cpp that uses a function named solve to compute the root, or value of x, of the equation a -1x 3 - b = 0, where a and b are input by a user via the keyboard. The function receives, as parameters, a and b, from the function named main and returns x if no error occurs and -1,000,000 otherwise.

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

1. Socialization policy in mass media?

Answered: 1 week ago

Question

1. What is employment? 2. What is the rewards for employment?

Answered: 1 week ago

Question

1. What is meant by Landslide? 2.The highest peak in Land?

Answered: 1 week ago

Question

What are the impact of sand mining in rivers ?

Answered: 1 week ago