get first to characters of line c++ code example
Example 1: swap first and last character of string in c++
std::swap(str.front(), 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;
}