Question
Write a program that will read from the monitor your full name (may include spaces and have any number of parts), and then greets you
Write a program that will read from the monitor your full name (may include spaces and have any number of "parts"), and then greets you appropriately.
Make sure you don't have any unnecessary variables! You need only ONE variable for this lab!
Keep in mind that full names can be 1, 2, 3, 4 or more words.
Examples:
- Mike Dukakis,
- Dr. Martin Luther King Jr.,
- John F. Kennedy,
- Madonna, etc.
Your program should:
- work correctly for ALL those examples and
- will skip initial white space. For this you need the ws stream manipulator. For a brief tutorial on the ws stream manipulator click here
- repeat for ever - see instructions here
In other words if the user enters " Mike Doukakis", your program should read into the fullName variable only "Mike Doukakis".
White space characters are:
- Regular space (hitting the space bar)
- New line (hitting "enter")
- Tab (hitting the "tab" key)
Note that you are NOT responsible for deleting any trailing white space or multiple white spaces in between parts of the name. So if the user enters "John F. Kennedy ", all the extra white space characters will be stored in your fullName variable.
Test your code thoroughly before you show it to me and compare your results with the results of my sample exe and the provided screen-shots.
- Make sure your formatting of your code and your output is correct (spaces and empty lines as well as indentations).
- Do not forget the comments on top!
- Make sure you do NOT include any libraries that you don't need.
- Make sure you follow the identifier naming conventions.
- For complete list of all the requirements that all labs must have follow this link (or panel on the left).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started