// main.cpp - Simple uses of structures - Structure defined differently than in struct.cpp

#include <iostream>
#include "student.h"
using namespace std;


void main(void){

   Student sam = {85, 90, 88}; // We initialize a student with an aggreagate value
   cout << sam;

   Student tom;
   cout << "Enter values for tom: ";
   cin >> tom;
   
   if (tom == sam)
     cout << "sam and tom are equal" << endl;
   else
     cout << "sam and tom are different" << endl;
   
   // We can assign a student to another student. For example:
   sam = tom;
   cout << sam;

   // We can access a structure and its fields through a pointer

   Student *he = &tom;
   cout << "*he = {" << he->mid << ", " << he->final << ", " << he->hmws << "}\n"; 
        // Notice the arrow notation for accessing the fields from he. 
        // The output will be *he = {85, 90, 88} 
   // We would get the same output if we access the fields in a different way:
   cout << "*he = {" << (*he).mid << ", " << (*he).final << ", " << (*he).hmws << "}\n";
   // And of course we can use <<
   cout << "*he = " << *he <<endl;
}



