#include <iostream>
#include <fstream>
using namespace std;
 
int main()
{
        const int ROWS = 10;
        const int COLS = 10;
 
        // create the array
        int** grades = new int*[ROWS];
        for (int i = 0; i < ROWS; i++)
               grades[i] = new int[COLS];
 
        // open data file
        ifstream fin("grades.txt");
        if (!fin)
        {
               cout << "* ERROR * unable to open file (grades.txt)" <<endl;
               exit(0);
        }
 
        // read data file into the array
        for (int j = 0; j < ROWS; j++)
               for (int k = 0; k < COLS; k++)
                       fin >> grades[j][k];
 
        // query student and assignment
        int student, assignment;
        char response;
        do
        {
 
               cout << "Enter student number [0..9]: ";
               cin >> student;
               cout << "Enter assignment number [0..9]: ";
               cin >> assignment;
 
               cout << "Grade was " << grades[student][assignment] <<endl << endl;
 
               // continue or stop?
               do
               {
                       cout << "Enter (Q)uit or (V)iew: ";
                       cin >> response;
               } while (response != 'Q' && response != 'V');
 
        } while (response != 'Q');
 
        return 0;
}
 

syntax highlighted by Code2HTML, v. 0.9.1