From 568365a6db67234bf837bd709eaaef7f284c178b Mon Sep 17 00:00:00 2001 From: KleptsovKD Date: Wed, 5 Feb 2025 01:03:06 +0300 Subject: [PATCH] Added word output --- lab04.1/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lab04.1/main.cpp b/lab04.1/main.cpp index 7acaf0e..429996d 100644 --- a/lab04.1/main.cpp +++ b/lab04.1/main.cpp @@ -12,7 +12,8 @@ int main() { const char* start = text; - while (true) { + while (true) + { size_t separator_count = strspn(start, SEPARATORS); start += separator_count; @@ -21,6 +22,12 @@ int main() { { break; } + + size_t word_length = strcspn(start, SEPARATORS); + + std::cout.write(start, word_length) << std::endl; + + start += word_length; } return 0;