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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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