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
Which account type is require to join the computer to the domain?
yulyashka [42]

Answer:

the computer must have an account in the domain which, like a user account, includes a logon name (sAMAccountName), a password, and a security identifier (SID) that uniquely represent the computer as a security principal in the domain.

Explanation:

-Hailey:

4 0
3 years ago
List three types of technical information sources that an IS professional might use when researching a new storage technology an
drek231 [11]

Answer:

The three types of technical information sources are:      

Vendor and manufacturer Web sites.

Technology-oriented Web sites and publications.

Professional society Web sites.              

Explanation:

Professional society Web sites provide most unbiased information.

These professional social websites are non profit companies as opposed to other sources of information that are profit making.

Social websites provides with the information that can help their members in a best way about getting information of their interest. This is done in an unbiased way because they do not work for some specific organizations or companies that want to sell their products or services.

7 0
4 years ago
6. kinukuha nito ang kabuuang bilang ng mga numerical na datos sa mga piniling cells
horrorfan [7]

Answer:

1.  Sum Function

2. Average Function

3. Max Function

4. Min Function

5. Count Function

Explanation:

4 0
3 years ago
What will you see on the next line?
sammy [17]

Answer:

c [2, 3.5, 7, 9]

Explanation:

8 0
3 years ago
This is not a Question
cricket20 [7]

Answer:

I've seen these a lot. What happens when you click on them tho?

Explanation:

5 0
3 years ago
Other questions:
  • Which of the following statements BEST describe why Agile is winning?
    14·2 answers
  • When a class contains a pointer to dynamically allocated memory, it is a good idea to equip the class with?
    9·1 answer
  • Which of these is a cultural form? A. Art B. Food C. Clothes D. All of the above
    8·2 answers
  • Dereck works for long hours on his computer. He frequently experiences physical strain by the end of the day because he does not
    13·2 answers
  • "The correct syntax for passing an array as an argument to a method when a method is called and an array is passed to it is: "
    15·1 answer
  • State why hexadecimal is used to display the error code
    11·1 answer
  • Lucy wants to add some notes in her research paper that provide additional information to the reader. She also wants to display
    14·1 answer
  • The best way to safeguard your document is to save it
    11·1 answer
  • There are 2048bytes in4megabytes true or false​
    10·1 answer
  • ______ lets people access their stored data from a device that can access the Internet.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!