Starting Out With C++, Early Objects - With Access Package
Starting Out With C++, Early Objects - With Access Package
8th Edition
ISBN: 9780133441840
Author: GADDIS
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 8.8, Problem 8.18CP

The following program segments, when completed, will ask the user to enter 10 integers, which are stored in an array. The function avgArray, which you must write, should calculate and return the average of the numbers entered.

// Write the avgArray function prototype here.

// It should have a const array parameter.

int main()

{

const int SIZE= 10;

int userNums[SIZE];

cout << "Enter 10 integers: ";

for ( int count= O; count< SIZE; count++)

{

}

cout << "#" << (count + 1)

cin >> userNums[count];

}

cout << "The average of those numbers is";

cout << avgArray(userNums, SIZE)<< endl;

return 0;

}

// Write the avgArray function here.

Blurred answer
Students have asked these similar questions
5. Write a function which will find the average of all elements of an array of integers. Pass an array and a dimension (the number of elements), and return the value of the average as a float ( the return value). Test this function in the main program with the array: 5, 7, 3, 5, 6, 4.
JAVA CODE PLEASE Functions with 2D Arrays Practice ll by CodeChum Admin Write a function named displayElements that takes a two-dimensional array, the size of its rows and columns, then prints every element of a two-dimensional array. Separate every row by a new line and every column by a space. In the main function, write a program that asks for integer input to be assigned on a 3 x 3 array and call the function displayElements to print the contents on the next line. Input 1. Multiple lines containing integer each line Output R1C1:·1 R1C2:·2 R1C3:·3 R2C1:·4 R2C2:·5 R2C3:·6 R3C1:·7 R3C2:·8 R3C3:·9 1·2·3 4·5·6 7·8·9 Score:
1- Write a user-defined function that accepts an array of integers. The function should generate the percentage each value in the array is of the total of all array values. Store the % value in another array. That array should also be declared as a formal parameter of the function. 2- In the main function, create a prompt that asks the user for inputs to the array. Ask the user to enter up to 20 values, and type -1 when done. (-1 is the sentinel value). It marks the end of the array. A user can put in any number of variables up to 20 (20 is the size of the array, it could be partially filled). 3- Display a table like the following example, showing each data value and what percentage each value is of the total of all array values. Do this by invoking the function in part 1.

Chapter 8 Solutions

Starting Out With C++, Early Objects - With Access Package

Ch. 8.6 - Given the following array definition: int values...Ch. 8.6 - Prob. 8.12CPCh. 8.6 - Prob. 8.13CPCh. 8.6 - What is the output of the following code? const...Ch. 8.8 - Write a typedef statement that makes the name...Ch. 8.8 - Prob. 8.16CPCh. 8.8 - What is the output of the following program...Ch. 8.8 - The following program segments, when completed,...Ch. 8.10 - Prob. 8.19CPCh. 8.10 - Prob. 8.20CPCh. 8.10 - Prob. 8.21CPCh. 8.10 - Prob. 8.22CPCh. 8.10 - Prob. 8.23CPCh. 8.10 - Fill in the empty table below so it shows the...Ch. 8.10 - Write a function called displayArray7. The...Ch. 8.10 - Prob. 8.26CPCh. 8.11 - Prob. 8.27CPCh. 8.11 - Write definition statements for the following...Ch. 8.11 - Define gators to be an empty vector of ints and...Ch. 8.12 - True or false: The default constructor is the only...Ch. 8.12 - True or false: All elements in an array of objects...Ch. 8.12 - What will the following program display on the...Ch. 8.12 - Complete the following program so that it defines...Ch. 8.12 - Add two constructors to the Product structure...Ch. 8.12 - Prob. 8.35CPCh. 8.12 - Prob. 8.36CPCh. 8.12 - Prob. 8.37CPCh. 8.12 - Write the definition for an array of five Product...Ch. 8.12 - Write a structure declaration called Measurement...Ch. 8.12 - Write a structure declaration called Destination ,...Ch. 8.12 - Define an array of 20 Destination structures (see...Ch. 8 - The ________ indicates the number of elements, or...Ch. 8 - The size declarator must be a(n) _______ with a...Ch. 8 - Prob. 3RQECh. 8 - Prob. 4RQECh. 8 - The number inside the brackets of an array...Ch. 8 - C++ has no array ________ checking, which means...Ch. 8 - Prob. 7RQECh. 8 - If a numeric array is partially initialized, the...Ch. 8 - If the size declarator of an array definition is...Ch. 8 - Prob. 10RQECh. 8 - Prob. 11RQECh. 8 - Prob. 12RQECh. 8 - Arrays are never passed to functions by _______...Ch. 8 - To pass an array to a function, pass the ________...Ch. 8 - A(n) ________ array is like several arrays of the...Ch. 8 - Its best to think of a two -dimensional array as...Ch. 8 - Prob. 17RQECh. 8 - Prob. 18RQECh. 8 - When a two -dimensional array is passed to a...Ch. 8 - Prob. 20RQECh. 8 - Look at the following array definition. int values...Ch. 8 - Given the following array definition: int values...Ch. 8 - Prob. 23RQECh. 8 - Assume that array1 and array2 are both 25-element...Ch. 8 - Prob. 25RQECh. 8 - How do you establish a parallel relationship...Ch. 8 - Look at the following array definition. double...Ch. 8 - Prob. 28RQECh. 8 - Prob. 29RQECh. 8 - Prob. 30RQECh. 8 - Prob. 31RQECh. 8 - The following code totals the values in each of...Ch. 8 - In a program you need to store the identification...Ch. 8 - Prob. 34RQECh. 8 - Prob. 35RQECh. 8 - Prob. 36RQECh. 8 - Prob. 37RQECh. 8 - Prob. 38RQECh. 8 - Each of the following functions contains errors....Ch. 8 - Soft Skills Diagrams are an important means of...Ch. 8 - Perfect Scores 1. Write a modular program that...Ch. 8 - Roman Numeral Converter Write a program that...Ch. 8 - Chips and Salsa Write a program that lets a maker...Ch. 8 - Monkey Business A local zoo wants to keep track of...Ch. 8 - Rain or Shine An amateur meteorologist wants to...Ch. 8 - Lottery Write a program that simulates a lottery....Ch. 8 - Rainfall Statistics Write a modular program that...Ch. 8 - Chips and Salsa Version 2 Revise Programming...Ch. 8 - Stats Class and Rainfall Statistics Create a Stats...Ch. 8 - Stats Class and Track Statistics Write a client...Ch. 8 - Prob. 11PCCh. 8 - Drivers License Exam The State Department of Motor...Ch. 8 - Array of Payro11 Objects Design a PayRoll class...Ch. 8 - Drink Machine Simulator Create a class that...Ch. 8 - Bin Manager Class Design and write an object...Ch. 8 - Tic-Tac-Toe Game Write a modular program that...Ch. 8 - Theater Ticket Sales Create a TicketManager class...

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
T F If a class has a pointer as a member, its a good idea to also have a copy constructor.

Starting Out with C++ from Control Structures to Objects (8th Edition)

Find AB and BA given A=[203415] and B=[137032].

Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis

What populates the Smalltalk world?

Concepts Of Programming Languages

Identity the termination condition in each of the following iterative statements. a. while (Count 5): . . . b....

Computer Science: An Overview (13th Edition) (What's New in Computer Science)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
1.1 Arrays in Data Structure | Declaration, Initialization, Memory representation; Author: Jenny's lectures CS/IT NET&JRF;https://www.youtube.com/watch?v=AT14lCXuMKI;License: Standard YouTube License, CC-BY
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License