C++ - Programming Language
This course covers the basics of programming in C++. Work your way through the videos and we'll teach you everything you need to know to start your programming journey!

Strings

Lesson 8
Author : Mike Dane
Last Updated : November, 2017


Code

Copy// #include <string>
string greeting = "Hello";
//      indexes:   01234

cout << greeting.length();
cout << greeting[0] << endl;
cout << greeting.find("llo") << endl;
cout << greeting.substr(2) << endl;
cout << greeting.substr(1, 3) << endl;