Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 13.1, Problem 1STE

Suppose your program contains the following type definitions:

struct Box

{

string name;

int number;

Box ‘next;

};

typedef Box* BoxPtr;

What is the output produced by the following code?

BoxPtr head;

head = new Box;

head->name = "Sally";

head->number = 18;

cout << (*head).name « endl;

cout << head->name « endl;

cout << (*head).number << endl;

cout << head->number « endl;

Blurred answer
Students have asked these similar questions
C ++ Using the following code:   enum GradeLevel { FRESHMAN, SOPHMORE, JUNIOR, SENIOR };   struct Student {     string      first;     string      middle;     string      last;     GradeLevel  year;     float       GPA; };   Student A0012; // Student ID A0012 Student A0013; // Student ID A0013   A0012.first = "Bjarne"; A0012.last = "Stroustrup"; A0012.GPA = 3.56; A0013 = A0012; A0012.year = SENIOR; A0013.middle = "C++"; A0013.year = static_cast<GradeLevels>(A0012.year - 2); A0013.GPA = floor(A0012.GPA); // floor() rounds down to whole number A0012.middle = A0013.middle.at(0) + ".";   What are the contents of the Student variables after this code has executed? Use the chart provided. Who is Bjarne Stroustrup?
C++ program #include <iostream> #include <string> #include<cstring>   using namespace std; const int NAME_SIZE = 20; const int STREET_SIZE = 30; const int CITY_SIZE = 20; const int STATE_CODE_SIZE = 3; class Customer { long customerNumber; char name[NAME_SIZE]; char streetAddress_1[STREET_SIZE]; char streetAddress_2[STREET_SIZE]; char city[CITY_SIZE]; char state[STATE_CODE_SIZE]; int zipCode; public: void setCustomerNumber(long customerNo) { customerNumber = customerNo; } bool setName(char name[]) { if (strlen(name) <= NAME_SIZE) { (this->name, name); returntrue; } returnfalse; } bool setStreetAddress_1(char streetAddress_1[]) { if (strlen(streetAddress_1) <= STREET_SIZE) { (this->streetAddress_1, streetAddress_1); returntrue; } returnfalse; } bool setStreetAddress_2(char streetAddress_2[]) { if (strlen(streetAddress_2) <= STREET_SIZE) { (this->streetAddress_2, streetAddress_2); returntrue; } returnfalse; } bool setCity(char city[]) { if…
struct gameType {     string title;     int numPlayers;     bool online; }; gameType Awesome[50];   Write the C++ statement that sets the first [0] title of Awesome to Best.

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
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
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ Data Members; Author: CppNuts;https://www.youtube.com/watch?v=StlsYRNnWaE;License: Standard YouTube License, CC-BY