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

Function main

Exercises/Modules/Chapter 20/Soln20_13/Soln20_13.cpp:84–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82
83
84int main()
85{
86 std::string text; // The string to count words in
87
88 // Read a string from the keyboard
89 std::cout << "Enter a string terminated by *:" << std::endl;
90 getline(std::cin, text, '*');
91
92 const Words words{ extractWords(text) };
93 if (words.empty())
94 {
95 std::cout << "No words in text." << std::endl;
96 return 0;
97 }
98
99 const WordCounts wordCounts{ countWords(words) };
100 showWordCounts(wordCounts);
101}
102
103Words extractWords(std::string_view text, std::string_view separators)
104{

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