A commentary on my technical exploits

Tag Archives: string objects

With some minor adjustments, we can use the C++ string class to accomplish our goal. We will use the C++ member function ‘append’ from the string class. My solution if fairly clean and simple. Here is the source:

4. Write a program that asks the user to enter his or her first name and then last name, andthat then constructs, stores, and displays a third string consisting of the user’s last name174 C++ PRIMER PLUS, FIFTH EDITIONfollowed by a comma, a space, and first name. Use string objects and methods from thestring header file. A sample run could look like this:Enter your first name: FlipEnter your last name: FlemingHere’s the information in a single string: Fleming, Flip