MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / main

Function main

Exercises/Modules/Chapter 11/Soln11_03/Soln11_03.cpp:7–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import <iostream>;
6
7int main()
8{
9 words::Words the_words;
10 std::string text; // The string to be sorted
11 const auto separators{" ,.!?\"\n"}; // Word delimiters
12
13 // Read the string to be processed from the keyboard
14 std::cout << "Enter a string terminated by *:" << std::endl;
15 getline(std::cin, text, '*');
16
17 words::utils::extract_words(the_words, text, separators);
18 if (the_words.empty())
19 {
20 std::cout << "No words in text." << std::endl;
21 return 0;
22 }
23
24 words::sorting::sort(the_words); // Sort the words
25 words::utils::show_words(the_words); // Output the words
26}

Callers

nothing calls this directly

Calls 4

sortFunction · 0.70
extract_wordsFunction · 0.50
show_wordsFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected