Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Assignment

Write a program that will display an array of 56 doubles on the screen, reverse the order of the array's values, and then display the array again.

Create and use the following functions with meaningful names in your solution:

• A function to set the value each element in an array of any length. Initialize an array such that first half of the array are random numbers between 0 and 1. Each element in the second half of the array must be equal to the square-root of their index. To initialize the array, use a single index variable and one or two counter-controlled loops. Make sure that the random numbers are different every time you run the program.Hint: To get a random number between 0 and 1, convert the random number to a double and then divide by RAND_MAX, which is a constant defined in the cstdlib that is the maximum value returned by the rand function.

• A function that prints an array of doubles of any size to the screen. The function should display 10 elements per line. Each value should be rounded to 2 decimal places. The output should be presented in a grid with right-aligned columns of equal width. The function should have two parameters: (1) a constant reference to the array and (2) a value parameter to get the array's size.

• A function that swaps two values in an array of doubles (located at two indexes). The function should accept three parameters: (1) the array, (2) the index of the first element to swap, and (3) the index of the second element to be swapped.

• A function that reverses the order of the values in an array of doubles. The function parameters should include a reference to an array and a copy of the array's size. Hint: start by swapping the first and last values in the array, then swap the second and next to last values, and continue until you reach the middle. The values of the array should be actually reversed. Do not put any cout statements within this function.
Important Reminders:

• Arrays can only be passed by reference. Do NOT use the symbol & when declaring an array as a formal parameter.

• Any array parameter for a function that does not modify that array should be a constant parameter.

• Functions that accept an array should not assume the array is a particular length. If the function goes though the length of the array, pass the array length as a parameter.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92748534

Have any Question?


Related Questions in Computer Engineering

Ethics and the information security professionwhat are the

ETHICS AND THE INFORMATION SECURITY PROFESSION What are the ethical dilemmas and challenges faced by information security professionals? Are professional organizations' ethical codes of conduct beneficial as an informati ...

It is just a simple calculator code c language ltstdiohgt

It is just a simple calculator code. C++ language library A) Display on the screen the following menu: Welcome to my calculator Please look at the menu below for your calculations 1. Addition 2. Subtraction 3. Multiplica ...

You have been offered a contract worth 1 million per year

You have been offered a contract worth 1 million per year for five years. However, to take the contract, you will need to purchase some new equipment. Your discount rate for this project is 12%. You are still negotiating ...

You are starting a company on a tight budget you can get

You are starting a company on a tight budget. You can get DSL line to your office with a static IP address, but ISP does not offer any DNS services. At this point you do not want to set up your own DNS, so you want to fi ...

You want to be a millionaire when you retire in 35

You want to be a millionaire when you retire in 35 years. a. How much do you have to save each month if you can earn an annual return of 10.7 percent?  (Do not round intermediate calculations and round your answer to 2 d ...

Short answer1 describe best case average case and worst

SHORT ANSWER 1. Describe best case, average case, and worst case in terms of Big O Notation. When implementing algorithms or data structures which two "Big O cases" are most important to consider and why? 2. Compare and ...

A static reference has the following two components in the

A static reference has the following two components in the JVM: The type of the reference; The fully qualified name of the reference, including its host class. From a security perspective for the JVM, investigate why sta ...

From the following information how would i work out the

"From the following information, how would I work out the standard error of the estimate for the regression model (in excel)? Multiple R=0.7545, Adjusted R Square=0.5077, Regression df=1, Residual df=7 SS=27.37 MS=3.91, ...

Explain the differences between working in the web based

Explain the differences between working in the web based version of Outlook in Office 365 to the desktop application version of Outlook.

Question summary of what is legal and regulatory

Question : Summary of what is legal and regulatory obligations regarding data and information security. Summary of project initiation in the technology world.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As