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

  Sketch the flowchart for user to enter credit card balance

Sketch the flowchart or write pseudocode for the application which permits user to enter credit card balance. suppose the interest rate is 1 percent per month

  Qiestion about update statement

A table namedPoints varchar(81) has values stored in a column named Point. There are 2-columns in the Points table, X and Y.

  Draw context diagram level zero and level one

Draw 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 of names saved in the system.

  Creating a flowchart and pseudocode

You have a document with the grades of students from Starting Programming, along with the students data. Your part of the program has to loop through records,

  Office automation and group collaboration software

Create a paper explaining what office automation and group collaboration software is used in your company. Include an review of the drawbacks and benefits of each software used.

  Describe and illustrate this law with examples

Describe and illustrate this law with examples. This law was published in 1965; is this law still valid today? Justify your answer with examples.

  Recognize possible use cases-actors to make use case diagram

Recognize possible use cases and actors, and create use case diagram for Personal Trainer information system. Choose one of the use cases and create a class digram.

  Choose one phase from the systems development life cycle

Choose one phase from the systems development life cycle to carry out, and present a summary of the core activities that you would undertake, with specific examples.

  Writing a pseudocode statement

Assume myCar is the name of a class variable that references an object, and go is the name of a method. Create a pseudocode statement that uses myCar variable to call method.

  Draw an ie crow-s foot e-r diagram for entities

Draw an IE Crow's Foot E-R diagram for the entities DEPARTMENT and EMPLOYEE and the 1:N relationship between them. Assume that a DEPARTMENT.

  Compute student grades via linux shell script

Construct a shell script to run on Knoppix or Linux, that will compute and display the letter grades for the students based on the average of four test scores.

  How to sketch flow chart to read employee master file

How to sketch flow chart to read employee master file and to output number of employees in each department who have a basic degree.

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