undeclared identifier

So everything before this part of the program works fine, but when I compile it there is a "undeclared identifier" fail message for the line
"recordCount = i++;" I am not sure where i went wrong?


int createStudentRecord( StudentRecord srArray[], int recordCount )

{
char response[MAX_STRING];
int NewIdNum;
int studentId = 0;
int studentInfo = 0;
StudentRecord newRecord;

cout << endl;
cout << " New Student Record " << endl;
cout << "-------------------------------------------" << endl;
cout << "Enter new student ID number: \n";
cin.getline( response, MAX_STRING );
NewIdNum = atoi( response );

{
if(studentInfo == -1)
{
newRecord.studentID = NewIdNum;
cout << "Enter first name: ";
cin.getline( newRecord.firstName, MAX_STRING );
cout << "Enter last name: ";
cin.getline( newRecord.lastName, MAX_STRING );
cout << "Enter date of birth (mm-dd-yyyy) : ";
cin.getline( newRecord.DOB, MAX_STRING );
newRecord.totalCourses = 0;
newRecord.totalCreditHours = 0;
newRecord.QPA = 0;
cout << endl;

srArray[recordCount] = newRecord;
recordCount = i++;
printStudentInfo( srArray[recordCount] = newRecord );

return recordCount;
}
else if( srArray[studentInfo].studentID == NewIdNum )
{
cout << "ERROR: A student record with ID Number " << NewIdNum << " already exist" << endl;
cout << "Exiting Create Student Record Appliction..." << endl << endl;
}
while( NewIdNum >= 10000 || NewIdNum <= 99999 )
{
studentInfo = searchByIdNumber( srArray, recordCount, NewIdNum );
}
}

return 0;
}

never mind, i fixed it. It was suppose to be recordCount =recordCount ++
You never define i in the code that you posted. Possible quick solution is to declare with the rest up top as

int i = 0;

EDIT: cross-post, glad you fixed it.
Last edited on
Topic archived. No new replies allowed.