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

  How proposed business is a lawnmower business

Main function, this will provide the menu interface to get to all the rest of them, it will basically be the switch statement that calls the other functions and returns their values.

  Difference between search language and a search engine

What is the difference between search language and search engine in terms of internet searching, and be specific.

  How many miles per gallon did the car average

How many miles per gallon did the car average between the two fillings?

  Analyze organizational requirements for application systems

Analyze organizational requirements for application systems. Evaluate organizational needs and provide solutions to secure software and applications.

  Why is there a restriction on the generation of icmp message

Why is there a restriction on the generation of an ICMP message in response to a failed ICMP error message?

  Write a program that computes and displays the perimeter

Write a program that computes and displays the perimeter of a letter-size (8.5 × 11 inches) sheet of paper and the length of its diagonal.

  Define trust model and mention some variations of ibis model

List the duties of a PKI. Define a trust model and mention some variations of ibis model discussed in this chapter.

  Write an assembly language program to input a string

Write an assembly language program to input a string from the user, count and display the number of times each word occur in the user input string.

  Write paper based on your crowdfunding research

Write a 4- to 5-page paper based on your crowdfunding research, select one that you consider to be an innovative technology or an innovative use of an existing technology

  Create data video by recording interactive data exploration

Create a data video/movie, by recording/filming an interactive data exploration. It should not be long, but how interesting/revealing can you make it?

  Create an algorithm for finding the penultimate node

Create an algorithm for finding the penultimate node in a singly linked list where the last element is indicated by a null next reference.

  Determine a course of action for the manager

Determine a course of action for the manager, using a decision tree and the expected value criterion.

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