Answer the question
In order to leave comments, you need to log in
How to make and output a slice of a string (String) C/C++?
I am writing a program that reads text and prints sentences line by line.
How to slice text from NumberArrayString th to i th element ?
int NumberArrayString = 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 << "-я строка: " << ???????????????????? << std::endl;
NumberArrayString = i;
}
}
Answer the question
In order to leave comments, you need to log in
one.
std::cout << text.substr(начало, длина) << std::endl;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question