Write a program that sets up an int array

Assignment Help Software Engineering
Reference no: EM13324811

Write a program that sets up an int array which has available positions with subscripts 0 through 199. We wish to enter quite a few integers into this array, but want to fill the array starting in the center, according to the rule: if the new integer is negative it should go in the position with subscript 99 (just left of the center), after moving over to the left by one position all the other integers already stored to the left of center. If the new integer is positive it should go in the position with subscript 100 (just right of the center), after moving over to the right by one position all the other integers already stored to the right of center.

We know the array is large enough to absorb all the new numbers fed in.

One way to write the program uses two functions. The first function accepts the array, the new negative integer, and the number of integers already stored to left of center. The function does the shifting over and puts in the new negative integer, so the array gets changed; it also adds 1 to howmanyonleft. The second function accepts the array, the new positive integer, and the number of integers already stored to right of center. The function does the shifting over and puts in the new positive integer, so the array gets changed; it also adds 1 to howmanyonrt.
Write the program that incorporates these two functions, as described. You will notice that the two functions have very similar statements, so you are doing some repetitive C++ code.

Then write a second program that uses just one function that efficiently will handle either situation. Make the one function as concise and elegant as possible. It should not have repetitive code.

Have your program read the data in from a file. Sample data files - of various lengths - will be posted under Assignments in Blackboard.

Reference no: EM13324811

Questions Cloud

What is the apparent position of the image : An object is 23.2 cm from the surface of a refiective spherical Christmas-tree ornament 5.11 cm in radius. What is the apparent position of the image
What is network infrastructure management : You have been tasked by your company to lead your team to plan, deploy and manage the computer / IT network for a large financial company "First Finance" who are shifting their head office to a new building. The whole project has to be completed i..
Which nucleotide is closer to the promoter : A particular cytosine (C) is upstream of a particular guanine (G) within a protein-encoding gene.
Which of the substrates is in the oxidized : Which of the substrates is in the oxidized form?
Write a program that sets up an int array : Then write a second program that uses just one function that efficiently will handle either situation. Make the one function as concise and elegant as possible. It should not have repetitive code.
What are the five factors of production : What are the 5 factors of production? Of these, which do you think the US has in abundance? Based on your answer to number 2, what industries should the US be focusing on and what are examples of industries. Name 2 ways that technology has helped bus..
Addition of caffeine to cells disrupts the dna : You have just read a paper that the addition of caffeine to cells disrupts the DNA damage checkpoint and you would like to understand why.
What is the magnitude of the trains acceleration : Amtrak's 20th-Century Limited is en route from Chicago to New York at 120km/h when the engineer spots a cow on the track. What is the magnitude of the train's acceleration
Find the direction of the couples displacement : One afternoon, a couple walks five-sixthsof the way around a circular lake, the radius of which is1.70km. What are the magnitude and direction (relative to due east) ofthe couple's displacement

Reviews

Write a Review

Software Engineering Questions & Answers

  How jane should deal with the two system analysts

Describe how Jane should deal with the two system analysts from a technical and human resource perspective and explain the factors that Jane should consider in establishing a process management solution.

  Describe the primary sdlc methodologies

The System Development Life Cycle has constructed over the decades to include a variety of Methodologies. Each of these Methodologies utilizes same processes in a different way.

  Describe your chosen architecture pattern

Include charts or diagrams created in Visio or an equivalent such as Dia. The completed diagrams / charts must be imported into the Word document before the paper is submitted.

  Explain elicitation of unb course registration system

As a system analyst to do requirement elicitation of UNB course registration system, use an example to tell how you can apply this technique to your elicitation task.

  C++ definitions

Mr. Oldie wishes to share his wisdom too, but on a different topic: "These OO-guys looked at hardware assembly and car assembly mechanisms and dreamed that they can do it in software.

  Create plan for converting shareware version to full version

Create the plan for converting shareware version to full version without paying one cent. If it is not possible for shareware to be converted to full version

  Prepare a report explaining the possible methods

Prepare a report explaining the possible methods that can be adopted in this particular scenario, resources required for the methods chosen for this investigation, approximate budget to conduct the investigation

  Create a table with a primary key to identify business

Construct a table that will store data about each student that took a course and what grade they received. The data should include the semester of completion.

  Tcp sender and receiver sequence

Think about a TCP sender and receiver. Suppose bytes 0 .. 99 have been sent, received, and acknowledged (the sender has received ack's for them). Suppose the sender sends the following segments

  What is involved in transformation of present business model

.Describe, using a dynamic business model, what is involved in the transformation of the present business model to realize this envisioned future.

  Debugging facilities for art of programming

The BlueJ development environment offers simple but sufficient debugging facilities for those new to and learning the art of programming.

  Drawing flowchart to accept two number

Draw a flowchart to accept two number and any one of the follwing characters: +,-,*, and / . based on the character entered, the number should be added.

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