// Mr. Minich // Computer Science Using C++
// Ch. 10 Demo Program #2 // January 30, 2000
// Purpose - This program illustrates the use of nested struct variables #include <iostream.h>
#include "M:\C++ Programming\AP classes\apstring.h"
struct Student
{
apstring firstName;
apstring lastName;
int age;
double gpa;
};
struct Class
{
int year;
int numStudents;
Student valedictorian;
};
int main()
{
Student teachersPet;
Student classClown;
Class seniors;
teachersPet.firstName = "John";
teachersPet.lastName = "Pseudocode";
teachersPet.age = 16;
teachersPet.gpa = 5.1;
classClown.firstName = "Hack";
classClown.lastName = "Er";
classClown.age = 17;
classClown.gpa = 0.3;
seniors.valedictorian = teachersPet;
cout << seniors.valedictorian.firstName << endl;
return 0;
}// end of main