A traditional valid email address can be of the form:
john_smith@panda-museum.co.uk
1) search for the @ character, does it appear only once? if yes: 2) search characters on the left of @: are they from the valid set? if yes: 3) search characters to the right of @: are they from the valid set? if yes: 4) does the character . appear at least once to the right of @? if yes: 5) the email address is valid.
if((offsetflag==true)&&(charflag==true))
{
cout<<"Is a valid email id"<<endl;
}
else
{
cout<<"Is not a valid email id"<<endl;
}
return 0;
}
bool isvalidchar(char c)
{
bool result = false;
if (c >='A' && c <= 'Z' || c >= 'a' && c <= 'z'|| c >= '0' && c <='9' ||c =='.'||c =='-' || c =='+'|| c =='@'|| c =='_') result = true;
return result;
}