// Ch. 14 Demo #6
// Purpose - to illustrate the use of a struct with a vector member variable
#include <iostream.h>
#include "M:\C++ Programming\AP classes\apvector.h"
#include "M:\C++ Programming\AP classes\apstring.h"
struct Class
{
apvector <apstring> names;
int gradYear;
apstring valedictorian;
};
int main()
{
Class seniors; // senior class at Wyomissing high school
int i = 0;
int num = 0;
cout << "How many students are in the senior class? ";
cin >> num;
seniors.names.resize(num);
cout << "Enter the names of all the students in the class: ";
for (i = 0; i < num; i++)
{
cin >> seniors.names[i];
}
cout << "What year will the class graduate? ";
cin >> seniors.gradYear;
cout << "Who is the valedictorian? ";
cin >> seniors.valedictorian;
return 0;
}// end of main