Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please C++ programming . . 5. Write a CH program that repeatedly prompts for and reads me mail address and then determines and displays whether

Please C++ programming image text in transcribed
image text in transcribed
image text in transcribed
. . 5. Write a CH program that repeatedly prompts for and reads me mail address and then determines and displays whether the address is valid or invalid. For purposes of this program, an e-mail address is valid if it satisfies these conditions: . The address cannot contain blanks For example, john smith@minneapolis.edu is not a valid e-mail address The @ character must occur exactly once. For example, baz.cs.dpu.edu and bar@cs@dpu are not valid e-mail addresses. The @ character cannot be the first character of the address. For example, @cs.dpu.edu is not a valid e-mail address. Every occurrence of the dot character (.) must have a non-@. non-dot character on both side. For example, bar@cs. ,.ed@comcast.net, and bar@.depaul, joe..smith@bob.com are not valid e-mail addresses. After reading an email address, the program should display it. If the address is valid, a message should be displayed stating that it is. For invalid addresses, the program should generate an error message for each of the above conditions that was violated Suggestions and hints: Use string class strings in your program. Write a separate bool-valued function to check each of the four invalidity checks given above. Each should receive the email address via a parameter and then return true if the email address is invalid according to the particular invalidity conditions. I Use a bool array of size four to store the results of calling each of these invalidity check functions If you have buffering problems when repeatedly reading strings and chars, make use of the function call cin.ignore (20.' ') to clear the buffer at appropriate times. Output from a sample run of the program (user input is one line in bold) Enter the address: john smith@minneapolis.edu You entered: john smith@mimeapolis.edu Not valid - contains a blank Enter another (y or n)? y Enter the address: baz.cs.dpu.edu You entered: baz.cs.dpu.edu Not valid - not exactly one *@" Enter another (y or n)? y Enter the address: bar@cs@dpu You entered: baracs @dpu Not valid - not exactly one @ Enter another (y or n)? y Enter the address: @cs.dpu.edu You entered: @cs.dpu.edu Not valid - @is first character Enter another (y or n)? y Enter the address: bar@cs. You entered: bar@cs. Not valid -contain a blank Enter another (y or n)? y ncast.net I LIR LAV Enter the address: .ed@comcast.net You entered: .ed@comcast.net Not valid - a dot is first or last, or preceded or followed by @or. Enter another (y or n)? y Enter the address: bar@.depaul You entered: bar@.depaul Not valid - a dot is first or last, or preceded or followed by @or. I Enter another (y or n)? y Enter the address: joe..smith@bob.com You entered: joe..smith@bob.com Not valid - a dot is first or last, or preceded or followed by @or. Enter another (y or n)? n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions