27 lines
472 B
C++
27 lines
472 B
C++
|
#include <string>
|
||
|
#include <iostream>
|
||
|
using std::string; using std::cout; using std::endl;
|
||
|
|
||
|
int main(int argc, char const *argv[])
|
||
|
{
|
||
|
string s("some string");
|
||
|
|
||
|
// if (s.begin() != s.end())
|
||
|
// {
|
||
|
// auto it = s.begin();
|
||
|
// *it = toupper(*it);
|
||
|
// }
|
||
|
|
||
|
for (auto it = s.begin(); it != s.end() && !isspace(*it); ++it)
|
||
|
{
|
||
|
*it = toupper(*it); // capitalize the current character
|
||
|
}
|
||
|
|
||
|
|
||
|
cout << (s) << endl;
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|