#include //#include using namespace std; string firstName, middleName, lastName; string fullName; // This assignment is worth 5 points. // -0.5 for making the substrings much longer than needed. // Lazy coding is something you should avoid if you can. int main() { cout << "Enter full name: "; cin >> firstName >> middleName >> lastName; fullName = firstName + middleName + lastName; cout << "This name has " << fullName.length() << " letters." << endl; cout << firstName.substr(0,1) << middleName.substr(0,1) << lastName.substr(0,1) << endl; cout << firstName.substr(firstName.length()/2, firstName.length() - firstName.length()/2) << middleName.substr(middleName.length()/2, middleName.length() - middleName.length()/2) << lastName.substr(lastName.length()/2, lastName.length() - lastName.length()/2) << endl; /* If you do length() - length()/2, the code autocorrects the string length for both odd and even numbered character strings to always get the correct length in this application. Similarly, you can also use length()/2 + length()%2 to accomplish the same thing. Formula length()/2 + 1 comes close, but misses the mark half the time. */ return 0; }