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

  Design context diagram for entering user-s name in system

Design Context diagram, level0 and level1 (if need) for the following: The user submit her/his name to the system, the system will tell the user if he is a boy or a girl or don't know by looking up his name in database

  Arithmetic calculator application

Create an application that permits the user to enter a series of numbers and manipulate them. The application should provide users with the option of adding or multiplying numbers.

  How the verify method can be used to plan out system

Analyze how the verify method can be used to plan out system effectively and ensure that the number of transactions do not produce record-level locking while the database is in operation.

  Draw a context diagram for the order system

Kitchen Gadgets sells a line of high-quality kitchen utensils and gadgets. When customers place orders on the company's Web site or through electronic data interchange

  Create flow chart which gets customer account data

Create the flow chart which gets customer account data which comprises the account number, customer name, and balance due.

  Explain use of er-assistant to depict conceptual model

Create your conceptual model, logical model, and few examples of what physical model would look like. Hint: You can use ER-Assistant to depict conceptual model and MS Access to depict logical model.

  Explain synchronization problem

There is a one way bridge that can hold up to 3-cars. Cars reach at one end of bridge and exit the bridge at the other end.

  Viruses and malicious software

Viruses and Malicious Software  Web Strategies and Protocols (browsers, cryptographic posture, and server and protocol securities)

  Determine one number missing from the sequence

Certain major software corporation likes to use in their interviews. Like many algorithm design problems, there are many possible answers, but I have presented one of the more generally accepted ones.

  Main building modules of entity relationship model

What are the main building modules of the Entity Relationship model? Discuss each one. What is a weak entity, and how is it represented in an E-R diagram? Give an example.

  Program calculate the total resistance in a circuit

A simple program is needed to compute the total resistance in a circuit. The resistors can either be in series or in parallel but not both.

  Identify several processes and concepts for managing project

Identify several processes and concepts for managing projects. Thinking about these processes and concepts, answer the following questions: Which process or concept do you feel would benefit your current organization the most? Explain.

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