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.
lisako
0
Newbie Poster
Recommended Answers
Jump to PostThis version of getline should probably be your tool of choice http://www.cplusplus.com/reference/iostream/istream/getline/
Beyond that, which parts are stumping you? Can you open a file? Can you search through the characters of a string?
Jump to PostLook at each character. Increment a value when you see @. When done, if the value is 1 you're goo, otherwise bad.
All 7 Replies
jonsca
1,059
Quantitative Phrenologist
Team Colleague
Featured Poster
lisako
0
Newbie Poster
lisako
0
Newbie Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
jonsca
1,059
Quantitative Phrenologist
Team Colleague
Featured Poster
lisako
0
Newbie Poster
jonsca
1,059
Quantitative Phrenologist
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.