Is there a function in c++ that will capitalize the first letter of the word, while the rest are lower case. Right now here is the only solution I can find and I don't think it is the best.
Code:
Code:
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string name;
cout << "Please enter a name: ";
getline(cin, name);
transform(name.begin(), name.end(), name.begin(), tolower);
name[0] = toupper((unsigned char)name[0]);
cout << "First letter capitalized: " << name << endl;
return 0;
}