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…
Declare three structs: Struct TravelInfo{ String name; Double weight; Double newWeight; Int planetChoice; Int speed; }; Struct TravelTimeCalc{ Int totalTravelTime; Int years; Int days; Int hours; }; Struct Planet{ String planetNames; Double distanceFromSun; Double gravity; }; Planets, distance from sun(millions of miles), surface gravity as a percent of earth’s gravity: Mercury  36   0.27 Venus   67   0.86 Earth   93   1.00 Mars  141  0.37 Jupiter  483  2.64 Saturn  886  1.17 Uranus  1782  0.92 Neptune  2793  1.44 Pass the arrays to the FillPlanetInfo function that will load the data into the three arrays.   Start a do while loop in main  Pass the function AskSpaceTravellerInfo a reference to the TravelerInfo struct variable and the array of planet names. Get the user’s name, Earth weight, the speed they want to travel and the planet they wish to visit.  Provide a menu with the planet names and a way for the user to select the chosen destination.   Pass the data you obtained…

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