Question: Given the following statements: struct nameType { string first; string last; }; struct courseType { string name; int callNum; int credits; char grade; }; struct
Given the following statements: struct nameType { string first; string last; }; struct courseType { string name; int callNum; int credits; char grade; }; struct studentType { unsigned queueSlot nameType name; double gpa; courseType course; }; studentType student; studentType classList[100]; courseType course; nameType name; Mark the following statements as valid or invalid. If a statement is invalid, explain why.
student.course.callNum = "CSC230"; wrong => type of callNum is int. so, we can't assign string to it
cin >> student.name; wrong => type of student.name is nameType. so, we can't use cin or cout on it
classList[0] = name; wrong => type of classList[0] is studentType and os name is nameType. since they are of two different structs, we can't use assignment operator
classList[1].gpa = 3.45; correct
name = classList[15].name; correct
student.name = name; correct
cout << classList[10] << endl; wrong => type of classList[0] is studentType. so, we can't use cin or cout on it
for(int j = 0; j < 100; j++) classList[j].name = name; correct
Using the declarations from the previous question. Write C++ statements to do the following:
Store the following information in course:
name: Programming I
callNum: 13452
credits: 3
grade: [the space character]
In the array classList initialize each queueSlot to the index value of the component inside of classList, and initialize each gpa to 0.0.
Copy the information of the thirty-first component of the array classList into student.
Update the gpa of the tenth student in the array classList by adding 0.75 to its previous value.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
