Write a program that will display an array on the screen

Assignment Help Computer Engineering
Reference no: EM131909867

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.

Reference no: EM131909867

Questions Cloud

Explain what the broadband privacy rules are : You need to explain what the broadband privacy rules are and how they affect individuals and businesses and why this is good or bad, in your opinion).
The relationship between harper handymen co and allen : Explain the agency relationship between Harper Handymen Co. and Allen. Would either party have the power to revoke or renounce the agency?
List a way that you believe you need to most improve : List a way that you believe you need to most improve how you perceive others. Explain what you can do to change it.
Calculate the cost of a level strategy : A regular employee can produce $10,000 worth of toys per month, and the company has 80 regular employees at the end of June. Regular-time employees are paid.
Write a program that will display an array on the screen : 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.
What will be the steps of the simplex method : What will be the steps of the simplex method for bounded variables when applied to this problem and Solve this problem by the simplex method
What are the amount and character of young recognized gain : In the current year, Young sells the property for $285,000, What are the amount and character of Young's recognized gain or loss on the sale
Explain the reinvestment rate and terminal wealth analysis : So what type of bond might you invest in if you were concerned that inflation was going to go up? Investors have been worrying about this for years now.
Prepare the market value statement of financial position : Prepare the Market Value Statement of Financial Position once the dividends have been declared, but not yet paid.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd