Creation and use of strings in C++

First you’ll need to call the string library on your code editor the same way you call iostream at the beginning of everything.

Screen Shot 2015-11-25 at 01.30.06

An easy example of the use of a string is by just calling one and printing some phrase on the monitor. For this you name the string and you choose what the string will print.

Screen Shot 2015-11-25 at 01.31.34As easy as that

Another way you can use a string is on the detection of a palindrome

here you’ll need to use the function length so it can be calculated the length of the string Screen Shot 2015-11-25 at 01.38.05

And later ask the user for the content of the string Screen Shot 2015-11-25 at 01.38.18

here’s the full code of that program

CC BY 4.0 Mastery 25 by Luis Daniel García is licensed under a Creative Commons Attribution 4.0 International License.