![Programming in C](https://www.bartleby.com/isbn_cover_images/9780321776419/9780321776419_largeCoverImage.gif)
Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Question
Chapter 10, Problem 8E
Program Plan Intro
Program Plan:
- Include the necessary headers
- Define the required variables and methods
- Define the main function
- Declare and initialize the required variables.
- Prompt the user to enter the values
- Call the method to perform the sort operation.
- Display the after performing sort operation
- Define the method “sort3()”
- Declare the required variables.
- Comparison is made using if condition for the three elements that are passed.
- Sort the values by checking three values.
Expert Solution & Answer
![Check Mark](/static/check-mark.png)
Trending nowThis is a popular solution!
![Blurred answer](/static/blurred-answer.jpg)
Students have asked these similar questions
Write a C user defined function
array and a value which you want to find in the
array. (function may be needs more parameter to
perform it) The function should check values of the
array and if it find the same value in the array, it
should return the position in the array (just first
one). If there is no match, it should return "-1"
Example: if array is {1,2,5, 3, 10, 5) and
if the search term is "10" function must return 4,
If the search term is "5" function must return 2,
If the search term is "9" function must return -1,
Q4: Write C++ program using funcions, write saperate functions for input and output, program should take input 10 numbers in an array, counts the zeros, even and odd numbers in array. Finally prints the total number of zeros, even and odd numbers
Q2: Write a C++ function (call it index_max) that finds the maximum number in the
array, that is passed to the function, and returns the max number and its index. For
example, if you pass [5,6,8,9,5,2] to the function, you obtain 9 and 3. Write a C++
program and test your function. Take the following notes into consideration when
writing your program:
1- Your function should work with any data type.
2- The function should prevent changing the elements of the passed array.
3- You are not allowed to use materials that are not covered in our lectures.
Chapter 10 Solutions
Programming in C
Ch. 10 - Type in and run the 15 programs presented in this...Ch. 10 - Write a function called to insert a new entry into...Ch. 10 - Prob. 3ECh. 10 - Write a function called r to remove an e from a...Ch. 10 - Prob. 5ECh. 10 - Prob. 6ECh. 10 - Prob. 7ECh. 10 - Prob. 8ECh. 10 - Prob. 9ECh. 10 - Prob. 10E
Knowledge Booster
Similar questions
- You are designing a function that will manipulate an array of integers. It needs to work for arrays of any length. What is the minimum number of parameters your function will have?arrow_forwardC++ Write a function named averageScores that takes in a float array of scores and the array’s size (stored as an int) as parameters. For each element in the array, ask the user to input a score and store it in the element. Then add that element to a running total of all the scores created in the array. Once you have gone through every element in the array, return the average of all of the scores.arrow_forwardWrite a program which should consists of a user defined function “maximum ()”. Pass 1D array to the function, along with number of elements of array. Find out the maximum element in 1D array using this function.[Note: Array should be passed using by reference approach] C languagearrow_forward
- (CAN YOU MAKE LESS FUNTIONS AND DO IT SIMPLE AND UNIQUE? PLEASE. THANK YOU ) PROGRAM IN C++ Odette's typhoon-related casualties. Create an array-based program that accepts the following data: the names of typhoon Odette victims, their ages, and their current status (A – alive, D – deceased, I – wounded, and M – missing). Your arrays should be proportionate to the barangay's expected population. Enter the barangay's name and the typhoon's projected total population. Following data entry, show the following information about each person according to their name - their name (in alphabetical order), their condition, the number of individuals who survived, died, were injured, or went missing, as well as their proportion of the total population. An Earthquake's Accident CODE OUTPUT : Barangay Name:____ Estimated NO. of residents:________ Name:____ Age:__ (A – alive, D – deceased, I – wounded, and M – missing)___ Additional Entry (Y/N)? Y…arrow_forwardUsing C language Write a function that determines standartdeviation of float array. The function takes dataset as afloat array parameter!! And it also return result as afloat.(Clue: calculate average first) Definations: in the image σ = standard deviationxi = each value of dataset? (with a bar over it) = the arithmetic mean of the data(This symbol will be indicated as average of dataset)N = the total number of data points(if you need square root of some number you can use sqrtfunction in math.h library. Usage example: a=sqrt(b);which means “a” is equal to square root of “b”)arrow_forwardComplete the below code with function declaration which is void sort and argument array you required to use qsort function with standard library.. Please so as soon asarrow_forward
- Question: Given an array of integers, find the maximum and minimum elements present in the array. Your task is to write a function that takes an array of integers as input and returns the maximum and minimum elements as a pair of integers..arrow_forwardConsider the following program that reads students’ test scores into an array and prints the contents of the array. You will add more functions to the program. The instructions are given below. For each of the following exercises, write a function and make the appropriate function call in main. Comments are to be added to the program. Write a void function to find the average test score for each student and store it in an array studentAvgs. void AverageScores( const int scores[][MAX_TESTS], int numberOfStudents, int numberOfTests, double studentAvgs[]); 2. Write a void function to find the average score on each test and store in an array testAvgs. 3. Write a void function to print the average score for each student, i.e. print the contents of the array studentAvgs. The output will be well formatted and accompanied with appropriate messages. 4. Write a void function to print the average score on each…arrow_forwardIn this assignment, rewrite the Bubble Sort, Selection Sort and Insertion Sort functions meeting the following requirements: 1) Each function must be implemented using recursion 2) Each function sorts a given array of numbers in descending order Your main program should be calling these functions with an unsorted array of numbers and then printing the results of the sorted array on the screen. You may test these functions using any data you deem appropriate. One example is to code main as follows: public static void main(String[] args) { int testArray1[] {... (use your own test data) ...}; int testArray2[] {... (use your own test data) ...}; int testArray³[] = {... (use your own test data) ...}; recursiveBubbleSort (testArray1, ...); = printArray (testArray1); recursiveSelectionSort (testArray2, ...); printArray (testArray2); recursiveInsertionSort (testArray3, ...); printArray (testArray3); } "printArray" in this example would be a function that prints the contents of the given array.…arrow_forward
- Perform matrix multiplication of 2D array. The program should meet the matrix multiplication rule i.e. number of columns of first matrix should be equal to the number of rows of second matrix. The input of two matrices A and B is given by user. Use function approach to handle array multiplication.arrow_forwardUsing “Def” keyword write a function that returns the Max element of the given array elements (The function name will be MaxofArrayElements) Not: Write some print functions to see the outputs inside each function. (Python programming language) (Solution must be like first image but max of arrays.it shouldnt be like second image)arrow_forwardQ4: Write a program using funcions, write saperate functions for input and output, program should take input 10 numbers in an array, counts the zeros, even and odd numbers in array. Finally prints the total number of zeros, even and odd numbers.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
![Text book image](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr