| [SOLVED] need help fixing code for c++ program,, Please? The program is supposed to read in a name ( last name, first name), break the name into two, and print using three separate functions. The printed code should be as follows. I entered: Last, First : as the name.
2) the first letter of the first name, a period, followed by a space, followed by the last name. (call this the first-initial method of printing)
3) the first letter of the first name, a period, the first letter of the last name, and then a final period-no spaces. (call this the two-initial printing method).
Here is the code I have.
f = first.substr(0, 1);
f += ". " + last;
cout << f << " is the first-initial method of printing";
fl = first.substr(0,1);
fl += "." + last.substr(0,1) + ".";
cout << fl << "is the two-initial method of printing";
This is what it prints.
,. Last is the first-initial method of printing
,.L.is the two-initial method of printi |