How to get substring of N length from a string starting from specific index in C++

1 Answer

0 votes
#include <iostream>
#include <string>

using std::cout;
using std::endl;
using std::string;

int main()
{
	string s("c++ programming");

	cout << s.substr(7, 4) << endl;

	return 0;
}

/*
run:

gram

*/

 



answered May 8, 2018 by avibootz
...