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

  Discuss the network handling code on a computer system

Ethics can be universally enforced and laws apply to everyone, Firewalls provide network protection based on a set of programs configured for each device

  What are the expected completion time

What are the expected completion time and the critical path for the landscaping project and What are the earliest and latest start and finish times for activity C

  Which is implemented using linked lists

An array can be used to hold a complete or full binary tree. Explain how he data structure would be set up and how a node's left and right children can be reached. What changes would be needed if there was a requirement to handle non-full, non-comp..

  Draw a sierpinski triangle using paper and pencil

Draw a call stack for the Tower of Hanoi problem. Using the recursive rules as described, draw a sierpinski triangle using paper and pencil.

  How secure are cloud computing

The paper needs to create a security model (in theory) that will protection an organization database and information - How secure are Cloud Computing?

  Questiona manufacturer of exercise equipment for health

questiona manufacturer of exercise equipment for health clubs is interested in comparing usage of equipment as in

  Briefly explain some of the issues that a company may face

information systems use security policy write a paper consisting of 500-1000 words double spaced about your experience

  Construct twelve-bit hamming code for characters a and three

The 12-bit string 010111110010 with embedded Hamming code bits (c8, c4, c2, and c1) has just arrived. Construct a 12-bit Hamming code for characters A and 3.

  Discus the marketing person will be unavailable

Assume that the Marketing person will be unavailable for one week, two months into the project

  Implement the topological sorting algorithm

Implement the topological sorting algorithm. Implement Kruskal's algorithm assuming that the edge weights are integers.

  Design visual basic 2010 program to analyze a mortgage

Write down a Visual Basic 2010 program to analyze a mortgage. The user should enter the amount of the loan, the annual rate of interest, and the duration of the loan in months.

  Questionmake an xml file in visual studio that contains the

questionmake an .xml file in visual studio that contains the exact same information. name files

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