Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help on C++ program please!!! Lab Assignment: 1. You will generate all of the code for this assignment, so begin by creating a new

need help on C++ program please!!!

image text in transcribed

Lab Assignment: 1. You will generate all of the code for this assignment, so begin by creating a new project with your driver file named 'main.cpp.' Then add functions that allow vou to read and write strings from/to a file. 2. Then, take the words that you read in from the example.txt that was provided in the repo and tally the strings in the file by inserting those strings into a map object. Here, the string part of the map will be the individual words read in from the file, and the int portion of the map is the number of times the string part has been inserted in the map. (Hint: figure out what the statement ++tally[item]; does when tally is a map and item is a string) Behind the scenes, the map container stores objects in a balanced binary search tree(research what it means for a tree to be balanced). The map iterator uses an inorder traversal to step through the tree objects, so the objects accessed by the iterator are encountered in sorted order. Think back to last lab and the three different traversal methods we discussed(pre/post/inorder) 3. Iterate through the tally map and write each string the correct number of times to the output file named output.txt. This means that the size of the output file will be the exact same as the input file but the words in output.txt will be sorted

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

Students also viewed these Databases questions

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Explain the alkaline nature of aqueous solution of making soda.

Answered: 1 week ago

Question

Comment on the pH value of lattice solutions of salts.

Answered: 1 week ago