<You are writing a program that will display names (first and last) in a column. The maximum size you are allowing for each full name is 30 characters per line. Assuming your program has a variable called theName, of type string, write the output statement needed to display the name right justified within the 30 spaces reserved. NOTE: You don’t know the actual name to display. That is, the statement should work with any name.>
Please don't include line numbers when you post code. This means that we can't just copy/paste the code into a compiler. If you use code tags then lines are given numbers.
As has been said above by salam_c, L16 doesn't do what you are expecting. In c/c++ , is an operator which means evaluate each expression separated by a comma from left to right and return as the result the value of the last expression evaluated (the rightmost one). So L16 means set theName to last.
For std::string, use + to concatenate. So L16 becomes
string theName = first + last;
You don't need setw() on L18 as only one item is displayed on the line.