| 42 | } |
| 43 | |
| 44 | void list_words(const vector<string>& words) |
| 45 | { |
| 46 | std::cout << "Your string contains the following " << words.size() << " words:\n"; |
| 47 | size_t count{}; // Number of outputted words |
| 48 | for (const auto& word : words) |
| 49 | { |
| 50 | std::cout << std::format("{:>15}", word); |
| 51 | if (!(++count % 5)) |
| 52 | std::cout << std::endl; |
| 53 | } |
| 54 | std::cout << std::endl; |
| 55 | } |