<p>Write a program that read\'s in a person\'s name in the following format: fir
ID: 3633587 • Letter: #
Question
<p>Write a program that read's in a person's name in the following format: first name, then middle name or initial, and then last name.  The program will the output  the name in the following format: <br />Last_Name, First_Name Middle_Initial.</p><p><br />For example, the input<br />Mary Average User<br />should produce the following output:<br />User, Mary A.<br />The input :<br />Mary A. User<br />should also produce the same output.</p>
<p><br />Your program should work the same and place a period after the middle initial even if the input did not contain a period.</p>
<p> Your program should allow for user who give no middle name or middle initial.  In that case, the output, of course, contains no middle name or middle initial.  For example:<br />The input:<br />Mary User<br />should output:<br />User, Mary<br />Please use C++ - strings for this assignment, not C-Strings.</p>
Explanation / Answer
#include #include using namespace std; // ==================== // main function // ==================== int main() { // // Variable declarations // string first, second, third; // strings read in char ch; // character in input after second string char middleInitial; // // Get the first two strings read in (first and middle names or // first and last names) coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.