Playground
#include <iostream> #include <string> using namespace std; int main() { string str = "alo alo alo halo"; cout << str.substr(0, 3) << endl; //pechati 'alo' cout << str.substr(0, 5) << endl; //pechati 'alo a' cout << str.substr(12) << endl; //pechati 'halo' cout << str.substr(12, 100) << endl; //pechati 'halo' return 0; }
Input data
Program output
no input
Execute
Language: ????????? | Memory: ???? KB | Time: ??? ms
Nothing has been executed, yet!