// 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;
};


class Listtype
{
public:
   void EnterList();
   void ShowList();

private:

   apvector <Student> myList;
};

void main()
{
   Listtype Studentlist;
   Studentlist.EnterList();
   Studentlist.ShowList();
}

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


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



