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

Function main

Examples/Modules/Chapter 20/Ex20_05/Ex20_05.cpp:19–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17size_t maxWordLength(const WordCounts& wordCounts);
18
19int main()
20{
21 std::string text; // The string to count words in
22
23 // Read a string from the keyboard
24 std::cout << "Enter a string terminated by *:" << std::endl;
25 getline(std::cin, text, '*');
26
27 const Words words{ extractWords(text) };
28 if (words.empty())
29 {
30 std::cout << "No words in text." << std::endl;
31 return 0;
32 }
33
34 WordCounts wordCounts = countWords(words);
35 showWordCounts(wordCounts);
36}
37
38Words extractWords(std::string_view text, std::string_view separators)
39{

Callers

nothing calls this directly

Calls 4

extractWordsFunction · 0.70
countWordsFunction · 0.70
showWordCountsFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected