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

  Research report on software design

Write a Research Report on software design and answer diffrent type of questions related to design. Report contain diffrent basic questions related to software design.

  A case study in c to java conversion and extensibility

A Case Study in C to Java Conversion and Extensibility

  Create a structural model

Structural modeling is a different view of the same system that you analyzed from a functional perspective. This model shows how data is organized within the system.

  Write an report on a significant software security

Write an report on a significant software security

  Development of a small software system

Analysis, design and development of a small software system.

  Systems analysis and design requirements

Systems Analysis and Design requirements

  Create a complete limited entry decision table

Create a complete limited entry decision table

  Explain flow boundaries map

Explain flow boundaries map the dfd into a software architecture using transform mapping.

  Frame diagrams

Prepare a frame diagram for the software systems.

  Identified systems and elements of the sap system

Identify computing devices, which could be used to support Your Improved Process

  Design a wireframe prototype

Design a wireframe prototype to meet the needs of the personas and requirements.

  Explain the characteristics of visual studio 2005

Explain the characteristics of Visual Studio 2005.

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