get the first letter of a string c++ code example
Example 1: get first and last character of string c++
auto first_char = str.front()
auto last_char = str.back()
Example 2: c++ first letter of string
// string::at
#include <iostream>
#include <string>
int main ()
{
std::string str ("Test string");
for (unsigned i=0; i<str.length(); ++i)
{
std::cout << str.at(i);
}
return 0;
}