Write a function sortit that receives two parameters

Assignment Help Computer Engineering
Reference no: EM132194650

Write a C++ program:

Assume all input and output is made to and from the console. In the main program, declare an array numbs with room for 50 integers, and an integer n, which will hold the number of filled positions in the array. The main program will call the functions readin, changeNeg, and sortit, described below.

The main program will send to readin the array numbs and n; it will send to changeNeg the array, n and an integer newval; and it will send to sortit the array numbs and n.

After calling changeNeg, the main program should print the count returned by the function, together with an appropriate message. The main program should also print the changed array.

Write a function readin which receives two parameters and does not return a value. The first parameter is the array (which the function calls vals) and the second integer reference parameter (which the function calls lim). The function will read in a series of integer values from the keyboard and store them in the array vals.

Assume there will be no more than 50 numbers read in. The function will read values until there is no more input. The function will place the number of values read in into the parameter lim.

Write a function changeNeg, which receives three parameters and returns an integer. The first parameter is the array, which the function calls arr, the second is the number of filled positions in the array, which the function calls n, and the third is an integer which the function calls somenum. The function should add somenum to each negative value in the array arr.

The function should also count the number of changes made and return that count to main. For example, if the array contains 28 -12 68 -9 the function would change -12 and -9 and return 2.

Write a function sortit that receives two parameters and does not return a value. The first parameter is an array which the function calls vals, and the second is an integer which the function calls n. The function sorts the first n elements in array vals into descending order (highest value first). For example, if the numbers in vals are 28 -12 68 -9 and n is 4, the sorted array will contain 66 28 -9 12.

Reference no: EM132194650

Questions Cloud

Write a c program to capitalize the first character : Write a C program to capitalize the first character in each sentence from a given file.
What is the power expended by each girl : Two girls, each of weight 400N climb up a rope through a height of 8 m. We name one of the girl And other B. Girl takes 20 sec while B takes 50 sec.
Find the speed of flow in the lower section : Water moves through a constricted pipe in steady, ideal flow. At the lower point shown in the figure below, the pressure is 1.85 ? 105 Pa and the pipe radius.
Calculate the root mean square value of the electric vector : The amount of electromagnetic energy recived by earth in the form of light from sun is 1300 W/metre. Calculate the root mean square value of the electric vector
Write a function sortit that receives two parameters : The main program will send to readin the array numbs and n; it will send to changeNeg the array, n and an integer newval;
Find the maximum value of magnetic intensity : The maximum value of electric field in an electromagnetic wave is 800V/m. Find the maximum value of magnetic intensity and the average value of Poynting vector.
What would be the orbital period if the earth were replaced : What would be the orbital period if the earth were replaced by a star of mass equal to the solarmass, in a circular orbit, with the distance.
Review the section on management leadership development : Identify two skills you would like to strengthen, and explain why these areas would help you supervise your new team - you recognize the need to strengthen
Calculate the apparent thickness of the plate : A flint glass plate (n= 1.66) rests on the bottom of an aquarium tank. The plate is 8.00 cm thick (vertical dimension) and covered with water (n= 1.33).

Reviews

Write a Review

Computer Engineering Questions & Answers

  What roles are you considering in your career future

What roles are you considering in your career future? What skills do you need to complete these roles (refer to your skills audit completed in module 2)?

  The perimeter method

The perimeter method is implemented in the superclass as it does not change based on the number of sides.

  What will be the estimated running times of sequential

What will be the estimated running times of Sequential Search under the above conditions for n = 100 in the best case, worst case, and average case?

  The decades to include various methodologies

The System Development Life Cycle has developed over the decades to include a variety of Methodologies. Each of these Methodologies utilizes the same methods in a different way. define the primary SDLC Methodologies, their advantages and disadvant..

  Create a function called build person

Create a function called build person. It will not have any input parameters, but it will return an object that represents a person.

  Evaluate the convection conductance in the usual manner

Consider fully developed laminar flow with constant properties in a circular tube. Let there be heat transfer to or from the fluid at a constant rate per unit.

  Draw a map to illustrate the above data structure

A 68020-based single-board microprocessor system is to be used to keep track of items in a shop. The shop sells up to N items.

  Explain the purpose of the schottky diode

Sketch a modified ECL circuit in which a Schottky diode is incorporated in the collector portion of the circuit. - Explain the purpose of the Schottky diode.

  How to prepare a two to three page memorandum

make a two to three page memorandum (350 words per page, from you to me) describing what office automation and group collaboration software is used in your organization.

  Draw the flow-dependence graph

COMP 326/5261 Assignment. Using the names 'l1' to 's1' for the first six instructions in the loop body, draw the flow-dependence graph for these instructions

  Start the application and connect to the database

Start the application and connect to the database. If a connection cannot be established, the application must exit. Display the record for a specified student

  What is bobs private key

What is Bob's private key?

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