Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago