Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
9th Edition
ISBN: 9780134498379
Author: Tony Gaddis
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 11, Problem 51RQE

Explanation of Solution

Syntax error:

An error which is occurred on the sequence of characters or tokens of a program is referred as “syntax error”; because the computer programs are strictly follows the syntax rules, if the code fails to prove its language syntax format then the compiler will throws error.

Structure:

In C++, the structure is a user-defined data type, which contains different type of elements with different lengths.

  • The size of the structure is calculated by the total number of elements which is declared in a structure.
  • The structure variable is used to access the member variables of a structure; if the structure variable is not declared, then the members of a structure cannot be accessed.

Syntax:

struct struct_name

{

member definition;

member definition;

member definition;

}struct_object;

Example:

//Structure definition

struct name

{

//Declare a character variable

char y;

//Structure object

} b;

In the above example, the “struct” is a keyword and “char” is a data type, “name” is a structure name, “y” is a member definition and “b” is a structure object...

Blurred answer
Students have asked these similar questions
} BMI(struct Person* person) { person->BMI = person->weight / (person->height person->height); return person->BMI; } //Q10: Why is the return type char*? char* determineWeightCategory(struct Person* person) {//assumes BMI is known const double UNDERWEIGHT = 18.5; const double NORMALWEIGHT = 24.9; const double OVERWEIGHT = 29.9; } else { //Q11: If the value in person->BMI is equal to 18.5 and person is athletic, what will be //stored in p- //Q12: The first if statement validates against certain conditions. //What are the conditions it is validating against? //HINT: Think about what causes BMI to be less than 0. if (person->BMI weightCategory, "ERROR"); } else if (person->BMI weightCategory, "Underweight"); } else if (person->BMI weightCategory, "Normalweight"); } else if (person->BMI weightCategory, "Overweight"); strcpy(person->weightCategory, "Obese"); return person->weightCategory; //Q13: Why do we return person->weightCategory? } //Q14: Why is provider passed by value?
Student Name: 8) Consider the following ciass definitions. public class LibraryID{ private String name; // Person's name private int ID; // Person's library ID # private ArrayList Books; // Loaned books public LibraryID (String n, int num) { name = n; ID = num; Books = new ArrayList(); } public int getID () { return ID; } public String getName() { return name; } /* CheckOut () and ReturnBook () methods not shown */ Complete the following override method, contained in the LibraryID class. Two LibraryID's are considered the same if their ID numbers are the same. public boolean equals (Object other) { if (other == null){ return false;} LibraryID o = (LibraryID) other; 9) Assuming the code written in 8 is correct, write the call to compare LibraryID one and two inside the if statement. LibraryID one = new LibraryID("Mankind", 106); LibraryID two = new LibraryID ("Mick Foley", 106); if System.out.println("ID's belong to the same person"); else System.out.println("ID's belong to the…
Term by CodeChum Admin (JAVA CODE) Construct a class called Term. It is going to represent a term in polynomial expression. It has an integer coefficient and an exponent. In this case, there is only 1 independent variable that is 'x'.   There should be two operations for the Term: public Term times(Term t) - multiplies the term with another term and returns the result public String toString() - prints the coefficient followed by "x^" and appended by the exponent. But with the following additional rules: if the coefficient is 1, then it is not printed. if the exponent is 1, then it is not printed ( the caret is not printed as well) if the exponent is 0, then only the coefficient is printed.  Input The first line contains the coefficient and the exponent of the first term. The second line contains the coefficient and the exponent of the second term. 1·1 4·3 Output Display the resulting product for each of the test case. 4x^4

Chapter 11 Solutions

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

Ch. 11.10 - Prob. 11.11CPCh. 11.10 - Write a function that uses a Rectangle structure...Ch. 11.10 - Prob. 11.13CPCh. 11.10 - Prob. 11.14CPCh. 11.10 - Prob. 11.15CPCh. 11.11 - Look at the following declaration: enum Flower {...Ch. 11.11 - What will the following code display? enum {...Ch. 11.11 - Prob. 11.18CPCh. 11.11 - What will the following code display? enum Letters...Ch. 11.11 - Prob. 11.20CPCh. 11.11 - Prob. 11.21CPCh. 11 - Prob. 1RQECh. 11 - Prob. 2RQECh. 11 - Prob. 3RQECh. 11 - Look at the following structure declaration:...Ch. 11 - Look at the following structure declaration:...Ch. 11 - Look at the following code: struct PartData {...Ch. 11 - Look at the following code: struct Town { string...Ch. 11 - Look at the following code: structure Rectangle {...Ch. 11 - Prob. 9RQECh. 11 - Look at the following declaration: enum Person {...Ch. 11 - Prob. 11RQECh. 11 - The ______ is the name of the structure type.Ch. 11 - The variables declared inside a structure...Ch. 11 - A(n) ________ is required after the closing brace...Ch. 11 - In the definition of a structure variable, the...Ch. 11 - Prob. 16RQECh. 11 - Prob. 17RQECh. 11 - Prob. 18RQECh. 11 - Prob. 19RQECh. 11 - Prob. 20RQECh. 11 - Declare a structure named TempScale, with the...Ch. 11 - Write statements that will store the following...Ch. 11 - Write a function called showReading. It should...Ch. 11 - Write a function called findReading. It should use...Ch. 11 - Write a function called getReading, which returns...Ch. 11 - Prob. 26RQECh. 11 - Prob. 27RQECh. 11 - Look at the following statement: enum Color { RED,...Ch. 11 - A per store sells dogs, cats, birds, and hamsters....Ch. 11 - T F A semicolon is required after the closing...Ch. 11 - T F A structure declaration does not define a...Ch. 11 - T F The contents of a structure variable can be...Ch. 11 - T F Structure variables may not be initialized.Ch. 11 - Prob. 34RQECh. 11 - Prob. 35RQECh. 11 - T F The following expression refers to element 5...Ch. 11 - T F An array of structures may be initialized.Ch. 11 - Prob. 38RQECh. 11 - T F A structure member variable may be passed to a...Ch. 11 - T F An entire structure may not be passed to a...Ch. 11 - T F A function may return a structure.Ch. 11 - T F when a function returns a structure, it is...Ch. 11 - T F The indirection operator has higher precedence...Ch. 11 - Prob. 44RQECh. 11 - Find the Errors Each of the following...Ch. 11 - Prob. 46RQECh. 11 - struct TwoVals { int a, b; }; int main () {...Ch. 11 - #include iostream using namespace std; struct...Ch. 11 - #include iostream #include string using namespace...Ch. 11 - struct FourVals { int a, b, c, d; }; int main () {...Ch. 11 - Prob. 51RQECh. 11 - struct ThreeVals { int a, b, c; }; int main () {...Ch. 11 - Prob. 1PCCh. 11 - Movie Profit Modify the program written for...Ch. 11 - Prob. 3PCCh. 11 - Weather Statistics Write a program that uses a...Ch. 11 - Weather Statistics Modification Modify the program...Ch. 11 - Soccer Scores Write a program that stores the...Ch. 11 - Customer Accounts Write a program that uses a...Ch. 11 - Search Function for Customer Accounts Program Add...Ch. 11 - Speakers Bureau Write a program that keeps track...Ch. 11 - Prob. 10PCCh. 11 - Prob. 11PCCh. 11 - Course Grade Write a program that uses a structure...Ch. 11 - Drink Machine Simulator Write a program that...Ch. 11 - Inventory Bins Write a program that simulates...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education