Question: Although the associative array is not a primitive data type, it is one of the most widely used data types due to its versatility and
Although the associative array is not a primitive data type, it is one of the most widely used data types due to its versatility and fast performance. In this project, you are to implement'word count' in C++ using an associative array Count the number of unique words in a sentence -Assume that only lower case letters are used, there's only one white space between words in the input sentence, and punctuation mark is separated from a word. -meaning all data preprocessing is done) You can implement your own associative array type, but STL map class performs very well. You can find examples in the CS455/456 textbook or by a google search (e.g https://www.cprogramming.com/tutorial/stl/stlmap.html) Submission hardcopy: attach your source code to this cover sheet softcopy: upload hw5.cpp to CourseWeb (DO NOT submit a zip file) 'll compile your code using g++ hw5.cpp -o hw5 on ACM. The maximum score for a non-executableon-compilable submission is 2/4 # word-count in python # word count # create associative array # extract word from string def wcount (string): dictionary dict() alist string.split() for word in alist if word in dictionary: # if word is already in the associative array dictionary[word] 1 else: dictionary[word] 1 return dictionary string = "this course examines important features of imperative and objected oriented programming it also introduces the fundamental principles of functional programming. we use python programming language to illustrate the concepts result wcount (string) for key, value in result.items() print (key, value)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
