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

Function main

Exercises/Modules/Chapter 11/Soln11_06/Soln11_06.cpp:15–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15int main()
16{
17 wrds::Words the_words;
18 std::string text; // The string to be sorted
19 const auto separators{" ,.!?\"\n"}; // Word delimiters
20
21 // Read the string to be processed from the keyboard
22 std::cout << "Enter a string terminated by *:" << std::endl;
23 getline(std::cin, text, '*');
24
25 w::extract_words(the_words, text, separators);
26 if (the_words.empty())
27 {
28 std::cout << "No words in text." << std::endl;
29 return 0;
30 }
31
32 wrds::sort(the_words); // Sort the words
33 w::show_words(the_words); // Output the words
34}

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