Computer Science Homework Solutions
Problem
#166178

Structs - Valid or Invalid Statements

Please see attached file.

If a statement is invalid, please explain why.  Your explanation doesn't have to be very detailed and long.  

Attached file(s):
Attachments
Chapter 11 Exercise 2.doc  View File

Attachment Content Summary (Note: view attachment at the above link before purchasing. Actual attachment content may vary slightly from that shown below.)

Chapter 11 Exercise 2.doc
Consider the following statements:

struct nameType

{

string first;

string last;

};

struct dateType

{

int month;

int day;

int year;

};

struct personalInfoType

{

nameType name;

int pID;

dateType dob;

};

Mark the following statements as valid or invalid. If a statement is
invalid, explain why:

person.name.first = “William”;

cout << person.name << endl;

classList [1] = person;

classList [20].pID = 000011100;

person = classList [20];

student = person.name;

cin >> student;

for (int j = 0; j < 100; j++)

classList [j].pID = 0000000;

classList.dob.day = 1;

student = name;
Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$7.98)
Included in Download
  • Plain text response
  • Attached file(s):
    • Chapter+11+Exercise+2_Answers.doc
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • Programming Concept: Arrays, Iterative Structures, Loop - Why are there so many iterative structures and what is the purpose of each. Think about looping and why different ones exist and why you can't have just one. What is an array and why are they imp ...
  • Effect of a continue statement in the body of a for loop - ****This needs to be in "C"**** Test the effect of a continue statement in the body of a for loop what is printed? for (putchar('1'); putchar('2'); putchar('3')) { putchar('4'); con ...
  • Data Structures + C++ STL - Give the value of v.size() after executing each of the following statements: (Be sure to include the code used to execute the statements. One program will be fine to execute all statements, no need to ...
  • Looping and Case Statements - 1. When using Case statements, what would happen if you did not Break? Please give an example and explain. 2. Where, in your everyday life, would you use all of the looping techniques, Ps ...
  • ref11) Stack elements and Instructions - Assume a stack-oriented processor that includes the stack operations PUSH and POP. Arithmetic operations automatically involve the top one or two stack elements. Begin with an empty stack. What stac ...
Browse