I'm trying to create a function that will set the first character in every string to uppercase and the rest of the characters to lowercase. When I run the program the printed strings are the same as what was entered. for example, if i enter "hELLO, hOW aRE yOU dOING?" the same strings are printed. I need it to print "Hello, How Are Yo[/s]u Doing?" if anyone can help with this thanks!!!
#include <iostream>
usingnamespace std;
const string & getString( string &firstCharUpper);
int main() {
//a function that will set the first character in every string to uppercase
string input;
cin >> input;
getString(input);
cout << input << endl;
return 0;
}
const string & getString(string &firstCharUpper) {
firstCharUpper[0] = toupper(firstCharUpper[0]);
return firstCharUpper;
}