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