Created
April 16, 2016 09:00
-
-
Save tanvir002700/6480fa6508e4c4aa1b95bc3bd38d965d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
#include<stdlib.h> | |
using namespace std; | |
int main() | |
{ | |
string str="somewhere, something incredible is waiting to be known."; | |
cout<<"Find some from first: "<<str.find("some")<<endl; | |
cout<<"Find some from last: "<<str.rfind("some")<<endl; | |
cout<<"substring: "<<str.substr(0,9)<<endl; | |
cout<<"substring: "<<str.substr(11,9)<<endl; | |
cout<<"lexicographically small: "<<min(str.substr(0,9),str.substr(11,9))<<endl; | |
cout<<"lexicographically large: "<<max(str.substr(0,9),str.substr(11,9))<<endl; | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Find some from first: 0 | |
Find some from last: 11 | |
substring: somewhere | |
substring: something | |
lexicographically small: something | |
lexicographically large: somewhere |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment