$29.99
COSC 2436 Lab 5: Hash Map
1. Introduction
You will implement a C++ program to perform the basic functionality of a map. Feel free
to use any structure you learned in class or in the standard library to implement the
program. Please name the folder on the server as “lab5”.
2. Input File
- You will be given a series of strings in the form of sentence(s).
- There can be empty files.
3. Output File
- Print the frequency associated with each string in alphabetical order.
4. Examples
input1.txt
It was the best sandcastle he had ever seen.
output1.txt
best: 1
ever: 1
had: 1
he: 1
it: 1
sandcastle: 1
seen: 1
the: 1
was: 1
input2.txt
It all started with the computer.
Had he known what was to follow, he would have never logged on that day.
output2.txt
all: 1
computer: 1
day: 1
follow: 1
had: 1
have: 1
he: 2
it: 1
known: 1
logged: 1
never: 1
on: 1
started: 1
that: 1
the: 1
to: 1
was: 1
what: 1
with: 1
would: 1
input3.txt
Terrance knew that sometimes it was simply best to stay out of it.
“It’s none of my business!”
He kept repeating this to himself as he watched the scene unfold.
He knew that nothing good would come of him getting involved.
It was far better for him to stay on the sidelines and observe.
He kept yelling this to himself inside his head as he walked over to the couple and
punched the man in the face.
output3.txt
and: 2
as: 2
best: 1
better: 1
business: 1
come: 1
couple: 1
face: 1
far: 1
for: 1
getting: 1
good: 1
he: 5
head: 1
him: 2
himself: 2
his: 1
in: 1
inside: 1
involved: 1
it: 3
it’s: 1
kept: 2
knew: 2
man: 1
my: 1
none: 1
nothing: 1
observe: 1
of: 3
on: 1
out: 1
over: 1
punched: 1
repeating: 1
scene: 1
sidelines: 1
simply: 1
sometimes: 1
stay: 2
terrance: 1
that: 2
the: 5
this: 2
to: 5
unfold: 1
walked: 1
was: 2
watched: 1
would: 1
yelling: 1
5. Turn in your lab assignment
Lab 5 needs to be turned into our Linux server, follow the link here
https://rizk.netlify.app/courses/cosc2430/2_resources/
Make sure to create a folder under your root directory, name it lab5 (the name must be
lowercase), and only copy your code to this folder, no test cases or other files are
needed.
PS: This document may have typos, if you think something is illogical, please email the
TAs for confirmation.