// main.cpp -- main program, and driver, for the class Student

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

#include "student.h"


int main()
{
  Student me("Ingargiola", "Giorgio", 80, 85, 90);
  
  cout << "I am: " << me << endl;
  cout << " with grade " << me.grade() << endl;
  
  enum {TABLESIZE=100};
  Student table[TABLESIZE];
  
  // Read the content of student.txt into table
  int n = readStudentFile("students.txt", table, TABLESIZE);
  if (n < 0)
    {
      cout << "Failure in reading the students.txt data file" << endl;
      return 1;
    } else if (n == 0)
      {
	cout << "The Student data file is empty" << endl;
	return 0;
      }
  
  // Display the content of table
  printStudentTable(table, n);
  
  // Write to students.out the content of table
  if (writeStudentFile("students.out", table, n) < 0)
    cout << "Failure in writing the students.out data file" << endl;
}

