assgn9/StudentDB.cpp
/**
 * Function to check it the student's first name is valid
 * @param firstname is the first name of the student
 * @return true if the first name includes only alphabetic characters;
 *	else, return false.
 *	Hence, names of people that include non-alphabetic characters
 *	will be considered invalid. This is a current program limitation
 *	given the assignment's specification. It should allow names with
 *	special characters to be valid, e.g. some European names with
 *	accented characters
 */
Function to check it the student's first name is valid
@param firstname is the first name of the student
@return true if the first name includes only alphabetic characters;
else, return false.
Hence, names of people that include non-alphabetic characters
will be considered invalid. This is a current program limitation
given the assignment's specification. It should allow names with
special characters to be valid, e.g. some European names with
accented characters
Function to check it the student ' s first name is valid @param firstname is the first name of the student @return true if the first name includes only alphabetic characters ; else return false . Hence names of people that include non - alphabetic characters will be considered invalid . This is a current program limitation given the assignment ' s specification . It should allow names with special characters to be valid e . g . some European names with accented characters
bool StudentDB::check_firstname(string firstname) {
	for (int i=0; i < firstname.size(); i++) {
		if (!isalpha(firstname[i])) {
			return false;
		}
	}
	return true;
}
bool StudentDB :: check_firstname ( string firstname ) { for ( int i = 0 ; i < firstname . size ( ) ; i ++ ) { if ( ! isalpha ( firstname [ i ] ) ) { return false ; } } return true ; }
Function to check it the student's first name is valid
 @param firstname is the first name of the student
 @return true if the first name includes only alphabetic characters;
      else, return false.
Function to check it the student ' s first name is valid @param firstname is the first name of the student @return true if the first name includes only alphabetic characters ; else return false .
//cout<<"fn pre for"<<endl; // Are there any non-alphabetic characters? //cout<<"fn for"<<endl; // Yes, the last name is invalid //cout<<"fn if"<<endl;