int main(void) { char str[50]; scanf("%s",str); valid_email(str); // your code goes here return 0; }
/*************************************************************************** * Purpose: Check to see if the email passed in takes on the form of * an email address. An email address has at least 1 * character followed by an @ symbol, then at least 1 * character followed by a period, and then 1 of a variety * of email endings, like edu and com. * * Entry: Takes in a QString which represents an email of a user * that is attempting to login or register. * * Exit: Returns a boolean value describing if the email takes on * the correct form of an email address. **************************************************************************/ bool CG_validator::checkValidEmailAddress(QString email) { //This regular expression should handle anything that represents a valid email. QRegExp valid_email("^[A-Za-z0-9\\._%+-]+@[a-zA-Z0-9\\.-]+\\.[a-zA-Z]{2,4}$"); bool is_email = true; if (valid_email.indexIn(email) == -1) //If the email doesn't match the email regular expression. { is_email = false; lbl_feedback->setText("You must have a valid email address."); } if (is_email) lbl_feedback->clear(); return is_email; }