Starting Out with C++ from Control Structures to Objects (9th Edition)
9th Edition
ISBN: 9780134498379
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 11.11, Problem 11.17CP
What will the following code display?
enum { HOBBIT, ELF = 7, DRAGON };
cout << HOBBIT << “ “ << ELF << “ “ << DRAGON << end˥;
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
C++
Sea A={luna); B={planetas del sistema solar};C={Marte, Júpiter};D={Mercurio, Venus, Tierra): encontrar
CUD =
#include <iostream>using namespace std;class Player{private:int id;static int next_id;public:int getID() { return id; }Player() { id = next_id++; }};int Player::next_id = 1;int main(){Player p1;Player p2;Player p3;cout << p1.getID() << " ";cout << p2.getID() << " ";cout << p3.getID();return 0;}
Run the program and give its output.
Chapter 11 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Ch. 11.4 - Prob. 11.1CPCh. 11.4 - Write a definition statement for a variable of the...Ch. 11.4 - Prob. 11.3CPCh. 11.6 - For Questions 11.4-11.7 below, assume the Product...Ch. 11.6 - Write a loop that will step through the entire...Ch. 11.6 - Prob. 11.6CPCh. 11.6 - Prob. 11.7CPCh. 11.6 - Write a structure declaration named Measurement,...Ch. 11.6 - Write a structure declaration named Destination,...Ch. 11.6 - Write statements that store the following data in...
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...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
A 100-mm-long rod has a diameter of 15 mm. If an axial tensile load of 10 kN is applied to it, determine the ch...
Mechanics of Materials (10th Edition)
How is the tool-work relationship in turning different from that in facing?
Degarmo's Materials And Processes In Manufacturing
CRC stands for a. Class, Return value, Composition b. Class, Responsibilities, Collaborations c. Class, Respons...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
This optional Google account security feature sends you a message with a code that you must enter, in addition ...
SURVEY OF OPERATING SYSTEMS
Modify the Product_T table by adding an attribute QtyOnHand that can be used to track the finished goods invent...
Modern Database Management
Repeat Question 25 for the method setDataAtCurrent.
Java: An Introduction to Problem Solving and Programming (8th Edition)
Knowledge Booster
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
- #include <iostream> using namespace std; class Player { private: int id; static int next_id; public: int getID() { return id; } Player() { id = next_id++; } }; int Player::next_id = 1; int main() { Player p1; Player p2; Player p3; cout << p1.getID() << " "; cout << p2.getID() << " "; cout << p3.getID(); return 0; } Execute and provide screenshot of output.arrow_forward#include <iostream> using namespace std; class Player { private: int id; static int next_id; public: int getID() { return id; } Player() { id = next_id++; } }; int Player::next_id = 1; int main() { Player p1; Player p2; Player p3; cout << p1.getID() << " "; cout << p2.getID() << " "; cout << p3.getID(); return 0; } Run the program and give its output.arrow_forward} 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?arrow_forward
- #include <iostream> #include <iomanip> double double showMenu(); double takePurchase(double); double takePayment(); double takePayment(); void displayInfo(double, double); double showMenu() {} double takePayment() { double takePurchase() { } double takePurchase (double) { } double takePurchase(double price) { } double takePayment() {} displayInfo (double purchase, double payment) void displayInfo (double purchase, double payment){} int quantity; return (price * quantity);arrow_forwardI have my code main.cc #include#include#include#include#include#include using namespace std; struct Point { double xCoor = 0; double yCoor = 0; bool isSolid;}; /* === Operation 1 - Print the map data === */class Rectangle { Point corner1, corner2; bool isSolid; public: Rectangle() { Point p1, p2; corner1 = p1; corner2 = p2; isSolid = false; } Rectangle(bool isSolid, Point p1, Point p2) { corner1 = p1; corner2 = p2; this->isSolid = isSolid; } void PrintData() { std::cout << "Corner1: (" << corner1.xCoor << ", " << corner1.yCoor << ")\n" "Corner2: (" << corner2.xCoor << ", " << corner2.yCoor << ")\n";if(corner1.isSolid and corner2.isSolid){cout<< "This rectangle is solid \n";}else{cout<< "This rectangle is not solid \n"; void ReadReactangles(string fileName) { int const MIN_ARGS = 5,IS_SOLID = 0, COOR1 = 1,…arrow_forwardFraction.h: #ifndef _FRACTION_H#define _FRACTION_H#include <iostream>using namespace std;class Fraction{int num;int den;public:Fraction();Fraction(int n);Fraction(int n, int d);void reduce();int GetNum()const;int GetDen()const;void SetNum(int n);void SetDen(int d);Fraction operator+(const Fraction&)const;Fraction operator-(const Fraction&)const;Fraction operator*(const Fraction&)const;Fraction operator/(const Fraction&)const;Fraction operator++();Fraction operator++(int);friend Fraction operator--(Fraction&);friend Fraction operator--(Fraction&, int);friend ostream& operator<<(ostream&, const Fraction&);friend istream& operator>>(istream&, Fraction&);friend bool isExact(const Fraction&, const Fraction&); //checks exact valuesfriend bool operator == (const Fraction&, const Fraction&);//checks equivalencyfriend bool operator < (const Fraction&, const Fraction&);friend bool operator > (const…arrow_forward
- snack.h #include <string>#include <iostream>#include <vector>class Snack{public:Snack(std::string, float, bool);int set_price(float);void set_expired(bool);void set_name(std::string);std::string name() const{return name_;}float price() const{return price_;}bool expired() const{return expr_;}int how_many_for_ten();private:std::string name_;float price_;bool expr_;};void SortByPrice(std::vector<Snack>&,bool); main.cpp #include <iostream>using namespace std; #include "snack.h" int main(){ Snack snicker=Snack("Snickers",2.0,false); std::cout<<snicker.name()<<" "<<snicker.price()<<" "<<snicker.expired()<<std::endl; Snack twix=Snack("Twix",3.0,false); std::cout<<twix.name()<<" "<<twix.price()<<" "<<twix.expired()<<std::endl; Snack mars=Snack("Mars",1.5,false); std::cout<<mars.name()<<" "<<mars.price()<<" "<<mars.expired()<<std::endl;…arrow_forward#include <string>#include <iostream>#include <vector>class Snack{public:Snack(std::string, float, bool);int set_price(float);void set_expired(bool);void set_name(std::string);std::string name() const{return name_;}float price() const{return price_;}bool expired() const{return expr_;}int how_many_for_ten();private:std::string name_;float price_;bool expr_;};void SortByPrice(std::vector<Snack>&,bool); Task: Implement a function working with Snack objects that are stored using a vector. It has the following signature: void SortByPrice(std::vector<Snack>& list_ref, bool asc). This function should sort the vector list_ref based on the price_ of the Snacks. The sorting should be done in the following order: Ascending if asc is true Descending if asc is false. In both cases if variables have the same value for price_, the sorting should be done based on the name_ in ascending order.arrow_forward#include <string>#include <iostream>#include <vector>class Snack{public:Snack(std::string, float, bool);int set_price(float);void set_expired(bool);void set_name(std::string);std::string name() const{return name_;}float price() const{return price_;}bool expired() const{return expr_;}int how_many_for_ten();private:std::string name_;float price_;bool expr_;};void SortByPrice(std::vector<Snack>&,bool); Task: Define the public function int Snack::set_price(float price) : If the value passed by price is smaller than 0 the function should return -2. If the value of price is greater or equal to 0, proceed as follows: If the value passed by price is smaller than the current value of price_, the function should assign price to price_ and return -1. If the value passed by price is larger than the current value of price_, the function should assign price to price_ and return 1. If price is equal to price_, the function should assign price to price_ and return…arrow_forward
- Assign Barbecue's data member numCalories with a value read from input. Then, assign Ham and Cheese's data member numCalories with another value read from input. Input will contain two integer numbers. #include <stdio.h>#include <string.h> typedef struct Pizza_struct { char pizzaName[75]; int numCalories;} Pizza; int main(void) { Pizza pizzasList[2]; strcpy(pizzasList[0].pizzaName, "Barbecue"); strcpy(pizzasList[1].pizzaName, "Ham and Cheese"); /* Your code goes here */ printf("A %s slice contains %d calories.\n", pizzasList[0].pizzaName, pizzasList[0].numCalories); printf("A %s slice contains %d calories.\n", pizzasList[1].pizzaName, pizzasList[1].numCalories); return 0;} please USE C++ I tried 10 time but I cant solve itarrow_forwardВ.width; } { t = B.type; w = { T.type = C.type; T.width = C.width; } T → B C В > int { B.type = integer; B.width 4; } В — foat { B.type = float; B.width = 8; } { C.type = t; C.width = w; } C - [ num] C1 = array(num. value, C1.type); { C.type C.width = num. value x C1. width; }arrow_forward#include #include #include "Product.h" using namespace std; int main() { vector productList; Product currProduct; int currPrice; string currName; unsigned int i; Product resultProduct; cin>> currPrice; while (currPrice > 0) { } cin>> currPrice; main.cpp cin>> currName; currProduct.SetPriceAndName (currPrice, currName); productList.push_back(currProduct); resultProduct = productList.at (0); for (i = 0; i < productList.size(); ++i) { Type the program's output Product.h 1 CSE Scanned Product.cpp if (productList.at (i).GetPrice () < resultProduct.GetPrice ()) { resultProduct = productList.at(i); } AM cout << "$" << resultProduct.GetPrice() << " " << resultProduct. GetName() << endl; return 0; Input 10 Cheese 6 Foil 7 Socks -1 Outputarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
C++ Data Members; Author: CppNuts;https://www.youtube.com/watch?v=StlsYRNnWaE;License: Standard YouTube License, CC-BY