struct nameType struct courseType struct studentType string first; string last;
ID: 3740365 • Letter: S
Question
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, eplain why. a. student.course.cal1Num-"CSC230" b. cin >> student.name; classList[0] name ; d. classlist[1].gpa- 3.45; e. name- classList[15].name; student. name = name; g. coutExplanation / Answer
A) student.course.callNum="CSC230";
it is invalid because callNum is int
B)cin>>student.name;
invalid , cannot read name of nameType struct
C) classList[0]=name;
invalid, cannot assign name of nameType to studentType
D)classList[1].gpa=3.45;
valid , classList has gpa
E)name=classList[15].name;
valid can assign nameType to nameType
F)student.name=name;
valid , can assign nameType to nameType
G)cout<<classList[10]<<endl;
invalid, can not print struct without selecting element in it
H)for(int j=0; j<100; j++)
classList[j].name=name;
valid, we can assign nameType to nameType
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.