How to make and display a slice of the string(String) C/C++?

Write a program that reads text and outputs the line-by-line suggestions.
How to make cut out text with NumberArrayString th to i-th element ?
NumberArrayString int = 0;
 int NumberString = 0;
 std::string text = {};
 getline(std::cin, text);
 printf("%d", text.size());
 for (int i = 0; i < (text.size()); i++)
{
 if ((text[i] == '.') || (text[i] == '!') || (text[i] == '?'))
{
NumberString++;
 std::cout << NumberString < < "row:" << ???????????????????? << std::endl;
 NumberArrayString = i;
}
 }
June 14th 19 at 20:02
1 answer
June 14th 19 at 20:04
Solution
1.
std::cout << text.substr(start, length) << std::endl;

As we have an educational text, then I will not tell. At random find out what will be the beginning and that long.

2. Nothing, if the string ends with a period, the last "neopredelennii" not displayed? Maybe true, but if the task is to separate text tab'am or comma is necessary after the cycle to throw out what is left.

Find more questions by tags C++Programming