#include<iostream>
using namespace std;

// Will output elements of the grades list to screen
// NOTE: If a function takes in a 1-dimensional array, it
//       is declared as  ... fcnName(int array[]);
//       but if it takes in a 2-dimensional array, it
//       is declared as ... fcnName(int array[][N]);
//       (where N is whatever number of elements is
//       in the second dimension of the array)
void printList(int grades[][4]);

// Reports if both students have same grade on a hw
void equalGradesCheck(int grades[][4]);

// Check if grades keep going up
void alwaysUp(int grades[][4]);

int main()
{
 // Initialize grades list to contain all -1s
 // (an impossible grade)
 int grades[2][4];
 for(int i=0; i<2; i++)
   for(int j=0; j<4; j++)
     grades[i][j]=-1;

 printList(grades);

 // Declare user single-input variables
 int studentNum, hwNum,  grade;

 // In my code, I will just keep looping forever,
 // getting more inputs about grades
 while(true)
 {
   // Ask for input
   cout << "Enter student and hw number: ";
   cin  >> studentNum >> hwNum;

   cout << "Enter grade: ";
   cin >> grade;


   // Insert grade into grade list
   grades[studentNum-1][hwNum-1]=grade;

   printList(grades);
   equalGradesCheck(grades);
   alwaysUp(grades);
 }


 return 0;
}


// Output to screen the grades in the list
void printList(int grades[][4])
{
 cout << "   1  2\n";
 for(int i=0; i<4; i++)
 { // loop for the grades for the 4 hw assignments
   cout << i+1 << " " << grades[0][i]
        << " " << grades[1][i] << endl;
 }
}



// Check if both students have the same grade on a hw
void equalGradesCheck(int grades[][4])
{
 for(int i=0; i<4; i++)
 { // check for each hw assignment
   // include check grades[0]!=-1 to only consider grades entered by user
   if(grades[0][i]==grades[1][i] && grades[0][i]!=-1)
     cout << "Students have same hw " << i+1
          << " grade!\n";
 }
}


// Check if grades keep going up
void alwaysUp(int grades[][4])
{
 for(int i=0; i<1; i++)
 { // Check for each student
   if(grades[i][0]<grades[i][1] &&
      grades[i][1]<grades[i][2] &&
      grades[i][2]<grades[i][3])
     cout << "Student " << i+1 << " grades are always increasing!\n";
 }
}