Hello everybody! I’m new to C++. Need some help. I am trying to prompt the user to enter the file name. File itself includes list of 5 emails.
After user enters the file name, program should check the list of emails and output all emails that have wrong email format (each email should have only one “@” character and one dot).
So I need to create 2 functions:
- bool oneAt(char email[] ); - to check if each email has ONLY one “@” character.
- bool oneDot(char* email); - to check if each email has ONLY one “.” (dot).
It should be really easy, but I just can’t implement it. I hope somebody can help me.
bool oneAt(char email[])
{
int NoOfAts = 0;
//Iterate through the 'email' string using a loop, and increment 'NoOfAts' when you found a '@'
//then return false if( NoOfAts == 0) else return true.
}
you can implement oneDot(char* email) in the same manner.