Starting Out with C++: Early Objects Plus MyLab Programming with Pearson eText -- Access Card Package (9th Edition)
Starting Out with C++: Early Objects Plus MyLab Programming with Pearson eText -- Access Card Package (9th Edition)
9th Edition
ISBN: 9780134520520
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 8, Problem 38RQE

A)

Explanation of Solution

Initialization of an array:

The C++ program allows the user to initialize the elements of an array while creating the array; the initialization list stores the value in an array in the specific order as they are initialized.

Example:

Consider the following snippet,

// Constant for the array size

const int num_of_days = 6;

// Initializing an array

int days[num_of_days] = {1, 2, 3, 4, 5, 6};

In the above example, the sequence of values are stored inside the braces and separated with commas is referred as initialization list.

Error in the given statement:

Consider the given statement,

// Initializing an array

int numbers[8] = {1,2, ,4, ,5};

In the above code, an error has been identified while initializing the values for the array “numbers”...

B)

Explanation of Solution

Implicit declaration of an array:

The C++ program allows the compiler to allocate a size for an array, which is not explicitly stated by the programmer.

Example:

Consider the following snippet,

// Initializing an array

int counter[] = {1, 2, 3, 4, 5, 6};

In the above example,the sequence of values are stored inside the braces and separated with commas. The compiler will automatically allocates an array of 6 integers...

C)

Explanation of Solution

Array elements:

The C++ program allows the user to initialize the elements of an array while creating the array; the array elements are of same data type and the type must be specified during the declaration.

Example:

Consider the following snippet,

// Initializing an array

int counter[] = {1, 2, 3, 4, 5, 6};

In the above example, the sequence of values are stored inside the braces and separated with commas. All elements in the array of int type.

Error in the given statement:

Consider the given statement,

// Initializing an array

values[3] = {6, 8...

Blurred answer
Students have asked these similar questions
Pseudocode for the student grade calculator program, please Create a program to enter grades and calculate averages and letter grades. Need a class which will contain: Student Name Student Id Student Grades (an array of 3 grades) A constructor that clears the student data (use -1 for unset grades) Get functions for items a, b, and c, average, and letter grade Set functions for items a, n, and c Note that the get and set functions for Student grades need an argument for the grade index. Need another class which will contain: An Array of Students (1 above) A count of number of students in use You need to create a menu interface that allows you to: Add new students Enter test grades Display all the students with their names, ids, test grades, average, and letter grade Exit the program Add comments and use proper indentation. Nice Features: I would like that system to accept a student with no grades, then later add one or more grades, and when all grades are entered, calculate the…
pls debug this pseudocode   // A high school is holding a recycling competition,// and this program allows a user to enter a student's // year in school (1 through 4) and number of cans collected// for recycling. Data is entered continuously until the user// enters 9 for the year.// After headings, output is four lines --// one for each school year class.start   Declarations      num year      num cans      num SIZE = 4      num QUIT = 9      num collectedArray[SIZE] = 0, 0, 0      string HEAD1 = "Can Recycling Report"      string HEAD2 = "Year      Cans Collected"   output "Enter year of student or ", QUIT, " to quit "   input year   while year <> QUIT      output "Enter number of cans collected "      input cans      collectedArray[year] = collectedArray[year] + cans      output "Enter year of student or ", QUIT, " to quit "      input year   endwhile   output HEAD1   output HEAD2   year = 1   while year < SIZE      output year, collectedArray[year]      year = year + 1…
Program Number 2: Password Verifier Imagine you are developing a software package that requires users to enter their own passwords. Your software requires that user’s passwords meet the following criteria: The password should be at least six characters long. The password should contain at least one uppercase and at least one lowercase letter. The password should have at least one digit. Contains at least one @ in array. Write a program that asks for a password and then verifies that it meets the stated criteria. If it doesn’t, the program should display a message telling the user why.

Chapter 8 Solutions

Starting Out with C++: Early Objects Plus MyLab Programming with Pearson eText -- Access Card Package (9th Edition)

Ch. 8.7 - Given the following array definition: int values...Ch. 8.7 - Prob. 8.12CPCh. 8.7 - Prob. 8.13CPCh. 8.7 - What is the output of the following code? const...Ch. 8.9 - Write a typedef statement that makes the name...Ch. 8.9 - Prob. 8.16CPCh. 8.9 - What is the output of the following program...Ch. 8.9 - The following program segments, when completed,...Ch. 8.11 - Prob. 8.19CPCh. 8.11 - Prob. 8.20CPCh. 8.11 - Prob. 8.21CPCh. 8.11 - Prob. 8.22CPCh. 8.11 - Prob. 8.23CPCh. 8.11 - Fill in the empty table below so it shows the...Ch. 8.11 - Write a function called displayArray7. The...Ch. 8.11 - Prob. 8.26CPCh. 8.12 - Prob. 8.27CPCh. 8.12 - Write definition statements for the following...Ch. 8.12 - Define gators to be an empty vector of ints and...Ch. 8.13 - True or false: The default constructor is the only...Ch. 8.13 - True or false: All elements in an array of objects...Ch. 8.13 - What will the following program display on the...Ch. 8.13 - Complete the following program so that it defines...Ch. 8.13 - Add two constructors to the Product structure...Ch. 8.13 - Prob. 8.35CPCh. 8.13 - Prob. 8.36CPCh. 8.13 - Prob. 8.37CPCh. 8.13 - Write the definition for an array of five Product...Ch. 8.13 - Write a structure declaration called Measurement...Ch. 8.13 - Write a structure declaration called Destination ,...Ch. 8.13 - 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 - When you pass the name of an array as an argument...Ch. 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 - Prob. 33RQECh. 8 - Prob. 34RQECh. 8 - In a program you need to store the identification...Ch. 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 - Larger Than n Create a program with a function...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 - Lo Shu Magic Square The Lo Shu Magic Square is a...Ch. 8 - Baseball Champions This challenge uses two files...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. 14PCCh. 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...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning