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
bartleby

Concept explainers

Question
Book Icon
Chapter 11.11, Problem 11.20CP
Program Plan Intro

Enumeration:

Enumeration is a user-defined data type which consists of enumerators; the enumerators are used to represent integer constants.

  • An enumeration can be defined by using the keyword “enum”.
  • By default, the values of enumeration type are filled with “0” to “n” sequentially and those default values can be changed when declaring the enumeration.
    • In a sequence of enumerators, if the first enumerator is assigned with a “user-defined value” and the next enumerator is not assigned with any value, then by default the next enumerator will be filled by the value “user-defined value of previous enumerator plus 1”.
  • The type name of an enumeration is optional; if name of the enumeration type is not given then it is referred as “anonymous”.

Syntax:

Syntax to declare an enumerated data type is as follows,

enum type_name {identifier_1, identifier_2, identifier_3, … identifier_n};

In the above syntax,

  • “enum” is the keyword used to declare an enumerator.
  • “type_name” refers the name of the type of the enumerator.
  • “identier_1” to “identifier_n” are refers the list of the identifiers declared in the enumerator.

Blurred answer
Students have asked these similar questions
Please Help me asap Please USE PYTHON Implement the design of the Pasta class so that the following output is produced:print("Pasta Plate Count:", Pasta.pasta_plate_count)print("=======================")s1 = Pasta("Chicken")s1.set_ingredients("Farfalle",250, 11, 40, 10)s1.display_all_info()print("------------------------------------")s2 = Pasta("Beef")s2.set_ingredients("Pipe Rigate",150, 10.5, 10, 10)s2.display_all_info()print("------------------------------------")s3 = Pasta("Mushrooms")s3.set_ingredients("Spaghetti",500, 50, 20, 10)s3.display_all_info()print("=======================")print("Pasta Plate Count:", Pasta.pasta_plate_count)Output:Pasta Plate Count: 0=======================Pasta Type: ChickenShape: FarfalleCal: 250 gFat: 11 gProtein: 40 gCarbohydrate: 10 g------------------------------------Pasta Type: BeefShape: Pipe RigateCal: 150 gFat: 10.5 gProtein: 10 gCarbohydrate: 10 g------------------------------------Pasta Type: MushroomsShape: SpaghettiCal: 500 gFat: 50…
What is the exact output (in C++) of the following pseudocode segment? METHOD MAIN CALL myMethod (0,2)CALL myMethod (3,5) CALL myMethod (6,7)  END MAIN   METHOD myMethod(A,B)BEGIN     WHILE (A < B)         PRINT(A + " ")         A ← A + 1    ENDWHILE    PRINTLINE();END myMethod
this code should be in python: you will be implementing a simple Tic-Tac-Toe game without the graphics.Here is how it works: • First, it is randomly determined if the user starts the game or the computer and thisinformation is shown to the user. The player who starts always starts as “X”.• The players (computer and the user) will then take turns in playing. The computer willchoose a random empty spot on its turn. The user enters its choice in the console.• Each of the empty spots have a corresponding number that the players choose on theirturn. If the user enters anything other than the number of an empty spot (not yet filledwith “X” or “O”), it will not be accepted, and they will be prompted to enter a correctnumber.                                                                                                                                                                          • After each turn, two things need to be done: 1) displaying the updated board 2) checkingif anyone has…

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
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
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,