Write a program Problem2_A.cpp that inputs several lines of text from the keyboard as C-strings and prints an alphabetical listing of each word in the text and how many times it occurred. To do this, keep a pointer to each word in an array of pointers. Use the qsort() function to sort the array of pointers and then count the number of occurrences of each word. Terminate input by signaling end-of-file from the keyboard. Ignore any case differences (e.g., “Cat” and “cat” are the same word). As a minimum requirement, you may assume there will be no punctuation marks and that exactly one space will separate words in the input lines
Comments
Leave a comment