C++ PLEASE Consider the following statements: struct nameType struct courseType
ID: 3700650 • Letter: C
Question
C++ PLEASE
Consider the following statements: struct nameType struct courseType struct studentType string first; string last; string name; int cal1Num; int credits; char grade; 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 a. student.course.callNum-"CSC230" b. cin >> student.name; c. classListf0]- name; d. classlist1).gpa 3.45 e. name - classList[15].name . student.name- name; coutExplanation / Answer
a)Invalid
callNum is of type int, whereas here it is being ssigned a string;
b)Invalid
student.name is a structure itself. To enter values in its variables, we need to individualy call them using . operator.
c)Invalid
classLis is of type studentType whereas name is of nameType;
d)valid
e)valid;
f)valid
g)Invalid
Each member of classList array is a structure, We need to individuall call its variables for printing
h)valid
i)valid
j)invalid
studentType is not a structure object, but a structurre itself.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.