I have a string: \"apple\". How can I convert only the first character to uppercase and get a new string in the form of \"Apple\"?
\"apple\"
\"Apple\"
I can al
#include using namespace std; void capitalize (string &s) { bool cap = true; for(unsigned int i = 0; i <= s.length(); i++) { if (isalpha(s[i]) && cap == true) { s[i] = toupper(s[i]); cap = false; } else if (isspace(s[i])) { cap = true; } } }