Capitalize Each Word

Looking for some help on getting each word capitalized. Currently what I have it capitalizes the first word, but lowercase's each remaining. How do I adjust this to make it capitalize each word? Thank you.

1
2
3
4
5
6
7
8
9
10
11
12
13
  cin.ignore();
			cout << "Album Name: ";
			getline(cin, album);
			cout << " " << endl;
			if (!album .empty())
			{
				album[0] = std::toupper(album[0]);

				for (std::size_t i = 1; i < album.length(); ++i)
					album[i] = std::tolower(album[i]);
			}
			showSongsByAlbum(count, album);
			cout << " " << endl;
Keep track of state. Are you within a word? Are you not? What do you do in those cases and what do you do when those states change?
Think about how you would do it on paper, then write up the tools you need.

If I were doing it on paper, I would look for spaces, and capitalize the following letter. (remember there are more delimiters than spaces however, you may want to check out the isspace function)
Topic archived. No new replies allowed.