1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Elina [12.6K]
3 years ago
8

Write a program that reads a list of words. Then, the program outputs those words and their frequencies. If the input is 5 hey h

i Mark hi mark (the first number indicates the number of words that follow), the output is:
hey 1
hi 2
Mark 1
hi 2
mark 1

Hint: Use two vectors, one for the strings, another for the frequencies.

Your program must define and use the following function: int GetFrequencyOfWord(vector wordsList, string currWord)
Computers and Technology
1 answer:
zysi [14]3 years ago
4 0

Answer:

/ declare the necessary header files.

#include <iostream>

#include <string>

#include <vector>

using namespace std;

// declare the main function.

int main()

{

// declare a vector.

vector<string> words;

vector<int> counts;

// declare variables.

int size;

string str;

cin >> size;

// start the for loop.

for(int i = 0; i < size; ++i)

{

// input string.

cin >> str;

words.push_back(str);

}

// start the for loop.

for(int i = 0; i < size; ++i)

{

int count = 0;

// start the for loop.

for(int j = 0; j < words.size(); ++j)

{

// check the condition.

if(words[j] == words[i])

{

count++;

}

}

counts.push_back(count);

}

// start the for loop.

for(int i = 0; i < size; ++i)

{

// display result on console.

cout << words[i] << "\t" << counts[i] << endl;

}

return 0;

}

Explanation:

You might be interested in
Sheila is using a process of saving files to her desktop and then renaming them. She is
inessss [21]

Answer: D

Use the internet to search for a new app to rename the folder.​

Explanation:

Rename function is used to change the name of the file or directory i.e. from old_name to new_name without changing the content present in the file. This function takes name of the file as its argument. There are many alternatives to this in which Sheila can found out through the internet.

5 0
3 years ago
Read 2 more answers
Select the correct answer.<br><br> Which statement is true with respect to Java?
NARA [144]

Answer:

where are the options ..... to select

7 0
2 years ago
A server needs to connect directly to the Internet. The ipconfig/all command shows that the server has been auto-assigned the IP
Deffense [45]

Answer:

Link-local address

Explanation:

IP addresses that have "FE80" as the hexadecimal representation of their first 10 bits are IPV6 reserved addresses for link-local unicast addressing. These addresses are automatically configured (though may be manually configured too) on any interface and should not be routed. They are used for addressing on a single link with the main aim, among others, of automatic configuration and routing protocol advertisement. Devices attached to this link can be accessed or reached using the link-local addresses as they don't need a global address to communicate.

However, routers will not forward datagram or packets using link-local addresses. In other words, routers are not allowed to connect to the internet using the unicast link-local addresses.

8 0
3 years ago
What does the Disk Defragmenter tool do?
rusak2 [61]
 It's kind of a mix between A and C there are some defragmenting tools that show you how much of your PC is wasted by program files. And in some defragmenting tools, it shows you all the files that are fragmented and gives you the option to defrag them or not. So the best answer would be A.  
7 0
3 years ago
A yellow inspection tag on a scaffold means the scaffold has been inspected and
kodGreya [7K]

Answer:CAUTION

Explanation: on edg

7 0
2 years ago
Other questions:
  • Point: A Point in a two dimensional plane has an integer x coordinate value and an integer y coordinate value.
    12·1 answer
  • Explain Cascading Style Sheets and what they do. Describe their primary function, two effects that this function has on programm
    11·1 answer
  • Which does plug-and-play refer to?
    13·2 answers
  • PLEASEEE HELPPPP me
    13·1 answer
  • Variablesallow us to manipulate data through the ___________.
    6·1 answer
  • During prereading, it is not important to pay attention to visual aids.<br> T f
    15·2 answers
  • We have written a method called sum with an int[] parameter nums. We want our sum method to compute the sum of nums, but our cod
    5·1 answer
  • You have a small company and want to keep your costs low, but it is important your employees share data. Which network would pro
    5·2 answers
  • Software that was designed to serve the needs of a specific company or organization is called:
    11·1 answer
  • By the mid-1990s, how did revenue generated from video games compare to revenue generated from movies?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!