assgn5/yassign5.cpp
bool check_social_security_number(string ssn) {
	for (int i=0; i < ssn.size(); i++) {
		/**
		 * Are there any non-digits in characters that are supposed
		 * to be digits?
		 */
		if ((i != 3) && (i != 6) && (!isdigit(ssn[i]))) {
			// Yes, the ssn is invalid
			return false;
		}else if(((i == 3) || (i == 6)) && (ssn[i]!='-')) {
			return false;
		}
	}
	return true;
}
/**
 * Function to check if the social security number is valid
 * @param ssn is a possible valid social security number of a
 *	student; ssn must contain only digits in all characters except
 *	the 4th and 7th, which are dashes
 * @return true if ssn is valid; else, return false
 */
Function to check if the social security number is valid
@param ssn is a possible valid social security number of a
student; ssn must contain only digits in all characters except
the 4th and 7th, which are dashes
@return true if ssn is valid; else, return false
Function to check if the social security number is valid @param ssn is a possible valid social security number of a student ; ssn must contain only digits in all characters except the 4th and 7th which are dashes @return true if ssn is valid ; else return false
bool check_social_security_number(string ssn) {
	for (int i=0; i < ssn.size(); i++) {
		if ((i != 3) && (i != 6) && (!isdigit(ssn[i]))) {
			return false;
		}else if(((i == 3) || (i == 6)) && (ssn[i]!='-')) {
			return false;
		}
	}
	return true;
}
bool check_social_security_number ( string ssn ) { for ( int i = 0 ; i < ssn . size ( ) ; i ++ ) { if ( ( i != 3 ) && ( i != 6 ) && ( ! isdigit ( ssn [ i ] ) ) ) { return false ; } else if ( ( ( i == 3 ) || ( i == 6 ) ) && ( ssn [ i ] != ' ' ) ) { return false ; } } return true ; }
Function to check if the social security number is valid
 @param ssn is a possible valid social security number of a
      student; ssn must contain only digits in all characters except
      the 4th and 7th, which are dashes
 @return true if ssn is valid; else, return false
Function to check if the social security number is valid @param ssn is a possible valid social security number of a student ; ssn must contain only digits in all characters except the 4th and 7th which are dashes @return true if ssn is valid ; else return false
/**
		 * Are there any non-digits in characters that are supposed
		 * to be digits?
		 */ // Yes, the ssn is invalid