access part of string in c 2b 2b

Solutions on MaxInterview for access part of string in c 2b 2b by the best coders in the world

showing results for - "access part of string in c 2b 2b"
Alan
19 Aug 2016
1#include <iostream>
2#include <string.h>
3
4using namespace std;
5int main() {
6   string str1 = "Apples are red";
7   string str2 = str1.substr(11, 3);
8   string str3 = str1.substr(0, 6);
9
10   cout << "Substring starting at position 11 and length 3 is: " << str2 <<endl;
11   cout << "Substring starting at position 0 and length 6 is: " << str3;
12   return 0;
13}
similar questions
queries leading to this page
access part of string in c 2b 2b