How can I make only my first letter upper case and all of the other letters lower case for the first, middle and last name. This program is a name formalize program, for an example if you wrote Mary Average User it would output User, Mary A. I want to be able to use it under #include <cctype> and it would be something like toupper and tolower with char. Please help me. Thanks
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main()
{
string name;
cout << "Enter your name: ";
getline(cin,name,'\n');
There is an implicit conversion from int to char, which would be applied;
why do you want to use a static_cast when the result is being assigned to char?
output = last + ", " + first + " " + middle.at(0) + ".";
}
cout<< output <<endl ;
return 0;
}
output:
name.cpp***
name.cpp: In function ‘int main()’:
name.cpp:25:6: error: expected
primary-expression before ‘else’
else
^~~~
name.cpp:39:5: error:
‘else’ without a previous
‘if’
else
^~~~