// PROG1808.CPP
// This program demonstrates using an array of records using
// apvectors and struct.


#include <iostream.h>
#include <conio.h>
#include "APVECTOR.H"
#include "APSTRING.H"


struct Student
{
   apstring Name;
   double GPA;
};

typedef apvector <Student> StudentList;

void EnterList(StudentList &);
void ShowList(StudentList);

void main()
{
   clrscr();
   StudentList Students;
   EnterList(Students);
   ShowList(Students);
   getch();
}

void EnterList(StudentList &St)
{
   int N;
   int K;
   apstring Dummy;
   cout << endl << endl;
   cout << "Enter the size of the list  ===>>  ";
   cin >> N;
   cout << endl;
   St.resize(N);
   for (K = 0; K < N; K++)
   {
      getline(cin,Dummy);
      cout << "Enter Student Name  ===>>  ";
      getline(cin,St[K].Name);
      cout << "Enter Student GPA   ===>>  ";
      cin >> St[K].GPA;
      cout << endl;
   }
}


void ShowList(StudentList St)
{
   cout << endl << endl;
   int N;
   int K;
   N = St.length();
   for (K = 0; K < N; K++)
   {
      cout << St[K].Name << endl;
      cout << St[K].GPA << endl;
      cout << endl;
   }
}



