Question: answer the question using the c++ String class 1) Write a code fragment that will use the + operator to concatenate two strings firstname and
answer the question using the c++ String class



1) Write a code fragment that will use the +" operator to concatenate two strings firstname and lastname together with a space between them. The strings are defined as follows: string firstname -"Cam"; string lastname"Newton"; (Note that the above is one way to initialize strings.) 2) Write a code fragment that will use the + operator to append the string username to the string message and store it into the string message_buffer where the username and the group name are first bracketed by the strings ".The username and the group name are separated by the string : ". The group name always begins with the character . The strings are defined as follows: string username"Scott"; string message"Welcome to our TigerBook Social Network!"; string groupname - "#A11"; string message buffer; After executing your code fragment, message_buffer must contain the following string: welcome to our TigerBook Social Network! 3) Write the code fragment that will use the above code in (2) to allow the program to prepend more user name and message into message buffer created in (2). string username2"Kathy"; string message2"Way to go, Scott!"; string groupname2 - #Tigers*
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
