Display a std::string from index i to the end of the string

Viewed 86

For example:

char s[]="abcde";
    for(int i=0;i<strlen(s);i++)
          cout<<s+i<<endl;

Output:

abcde
bcde
cde
de
e

And this doesn't ruin the char array.

What I want to ask for help is, is there another way we can do that with the std::string class?

1 Answers
Related