I been working on this code for a day or two for a school assignment but having a little bit of a hard time.

1.) In line 75 and 81 i do a function call to check if they are int or not. For some reason the error message gets displayed 2 times the first time.
2.) In line 86 I start a loop to dynamically allocate memory but in line 124 I'm not quite sure how to delete it ^^

I'm still working on this code just wanted to see what feedback I would get from here

Code:
#include <iostream>
#include <string>
using namespace std;

/*
Test Scores Tracker
Created By:			Moises Tadeo
Last Modified On:	12/01/12

Program Description:
Write a program that uses a structure to store the following data:

Member		Name		Description
Name		Student		name
Idnum		Student		ID number
Tests		Pointer		to an array of test scores
Average		Average		test score
Grade		Course		grade

The program should keep a list of test scores for a group of students. It should ask the
user how many test scores there are to be and how many students there are. It should
then dynamically allocate an array of structures. Each structure s Tests member
should point to a dynamically allocated array that will hold the test scores.
After the arrays have been dynamically allocated, the program should ask for the ID
number and all the test scores for each student. The average test score should be calculated
and stored in the average member of each structure. The course grade should
be computed on the basis of the following grading scale:

91 - 100 A
81 - 90 B
71 - 80 C
61 - 70 D
60 or below F

The course grade should then be stored in the Grade member of each structure. Once
all this data is calculated, a table should be displayed on the screen listing each student
s name, ID number, average test score, and course grade.

Input Validation: Be sure all the data for each student is entered. Do not accept negative
numbers for any test score.


Need to finish / fix
data validation
delete allocated memory loop testScores


*/

// Each "Student" struct will contain this information:
// 1. string(name) 2. string(id) 3. int pointer(pScores)
// 4. int(average) 5. int(grade)
struct Student
{
	string	name;		// Name of student.
	string	id;			// ID
	int*	pScores;	// Pointer to scores.
	int		average;	// Average test scores.
	char	grade;		// His/her grade.
};

// Function Prototypes
void dispalyStudentsInfo(Student * x, int y);
char calculateGrade(Student * x,int y);
int intValidation(int x);

int main()
{
	int		studentAmount;			// How many students total.
	int		testAmount;				// How many test each student had in total.
	Student *pStudent;				// Pointer to array of structures.
		
	cout << "Total number of students?: ";							// How many students total.
	cin >> studentAmount;
	studentAmount = intValidation(studentAmount);					// Processed by intValidation and corrent input is saved on studentAmount;



	cout << "How many test total?: ";								// How many test total.
	cin >> testAmount;
	testAmount = intValidation(testAmount);							// Processed by intValidation and corrent input is saved on testAmount;

	
	pStudent = new Student[studentAmount];							// Dynamically allocate array of structures.
																	// Check if memory is available
	for(int index = 0; index < studentAmount; index++)		
	{
		pStudent[index].pScores = new int[testAmount];				// Dynamically allocate array to store test scores for every student.
																	// Save the Dynamically allocated array addresses to each array of structure.
																	// Check if memory is available.
	}

	for( int index1 = 0; index1 < studentAmount; index1++)			// Get information about the students and store the data.
	{
		cout << "What is student #" << (index1 + 1) << " Name?: ";							// Ask for the students name
		cin >> pStudent[index1].name;
		cout << "What is student #" << (index1 + 1) << " ID number?: ";						// Ask for user ID number
		cin >> pStudent[index1].id;
		
		int accumulator = 0;																// Add all the test results to this variable

		for(int index2 = 0; index2 < testAmount; index2++)
		{
			cout << "How many points on test #" << (index2 + 1) << ": ";					// Ask the user for the test results
			cin >> pStudent[index1].pScores[index2];
			accumulator += pStudent[index1].pScores[index2];								// Add the current test to the accumulator
			pStudent[index1].average = (accumulator / testAmount);							// Save the average divided by the amount of test taken and save it
		}
	
	pStudent[index1].grade = calculateGrade(pStudent,index1);		// Function call and save the return value to grade member of the structure.
	// cout << pStudent[index1].grade << endl;

	system("pause");
	system("cls");
	}

	dispalyStudentsInfo(pStudent, studentAmount);					// Function call to display the results of all the students!

	
	delete [] pStudent;												// Free up dynamically allocated memory used for structures.
	pStudent = 0;													// Set pointer to NULL.

/*
	for(int index = 0; index <studentAmount; index++)				// Loop to delete all the dynamically allocated memory.
	{
		delete [] pStudent[index].pScores;							// Free up dynamically allocated memory used for test scores.
		pStudent[index].pScores = 0;								// Set all pointer to NULL.	
	}
*/

	system("Pause");
	return 0;
}

// Function will display all the student information
// Parameters:
// struct x will hold the address of a structure array.
// int y will hold the amount of students in class.
// loop and display results.
void dispalyStudentsInfo(Student * x, int y)
{
	for(int index = 0;index < y; index++)
	{
		cout << "Name:\t\t" << x[index].name << endl;
		cout << "ID:\t\t" << x[index].id << endl;
		cout << "Average:\t" << x[index].average << endl;
		cout << "Grade:\t\t" << x[index].grade << endl << endl;
	}
}
// Function will display the grade of the current student
// Parameters will need a Student structure represented by x and
// the the array subscript to display the result.
char calculateGrade( Student * x,int y )
{
	if(x[y].average >= 91)
		return 'A';
	else if(x[y].average <= 90 && x[y].average >=81)
		return 'B';
	else if(x[y].average <= 80 && x[y].average >=71)
		return 'C';
	else if(x[y].average <= 70 && x[y].average >=61)
		return 'D';
	else
		return 'F';
}
// Verifies that x is an int value. If it isn't then
// display error message.
// Bug. Displays two error messages the first time it runs.
int intValidation(int x)
{							
	while(!(x) || x <= 0)
	{
		cout << "\tERROR! Please enter a \"DIGIT\" greater than \"0\": ";	// Error if incorrect data is entered!
		cin.clear();
		cin.ignore (100, '\n');	
	}
	return x;
}
int intTestPointsValidation(int x)
{

	return x;
}