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
What offers backup services that use cloud resources to protect applications and data from disruption caused by disaster? Multip
sattari [20]

Answer:

The correct answer to the following question will be "Disaster Recovery as a Service (DRaaS)".

Explanation:

DRaaS seems to be a cloud services term used only to secure an infrastructure or data through human catastrophe or interruption of service at any destination by allowing a complete recovery throughout the cloud.

  • DR seems to be a security or management preparation field which seeks to protect an organisation from those in the consequences of major negative experiences.
  • This provides offsite backups which use storage resources to defend programs including assets from disaster-induced destruction.

8 0
3 years ago
How do i do a mutioutput on a mac
Tcecarenko [31]
Here's what I found

To use an aggregate device with Logic:
Open Logic Pro or Logic Express.
Choose Logic Pro > Preferences > Audio or Logic Express > Preferences > Audio and select the Devices tab.
Select the Output Device drop-down menu and choose the aggregate device from the list. ...
Click Apply Changes at the bottom-right of the window.
4 0
3 years ago
What is the name for the base-2 system used by computers to represent
NemiM [27]

Answer:

B. Binary Code

Explanation:

Binary code is the base-2 system used by computers to represent data. Binary code consists of 0's and 1's which can be used to represent states such as on or off; go or no-go and more.

7 0
1 year ago
What was the first e-commerce service?
docker41 [41]

The first e-commerce service would be A)Banking. Hope this helps.

8 0
3 years ago
The _______ is a small program run by a computer when first powered on. its primary function is to stabilize the machine and dev
tigry1 [53]
Hello <span>TheCelloAlex1645 </span>

Answer: <span>The BIOS is a small program run by a computer when first powered on. its primary function is to stabilize the machine and devices on the motherboard so that the operating system can be loaded and take control of the computer.


Hope this helps
-Chris</span>
3 0
3 years ago
Other questions:
  • Desktop, laptop, and tablet computers, and mobile devices are classified as _______.
    7·1 answer
  • Suppose the program counter (pc) is set to 0x2000 0000. is it possible to use the jump (j) mips assembly instruction to set the
    15·1 answer
  • Your organization will be handling market trades. You will be required to verify the identify of each customer who is executing
    8·1 answer
  • How do you interpret field in contest of a DBMS?
    5·1 answer
  • Florida revoked __________ drivers licenses for DUI in a one-year period from 2009 to 2010.
    6·2 answers
  • Image-editing software is used to _____.
    15·2 answers
  • With a presentation open, you can hover your mouse pointer over a design theme on the Design tab, and PowerPoint will display th
    14·1 answer
  • Which code must be included to use Turtle Graphics?
    14·2 answers
  • Why is a computer called"a computer"?​
    12·2 answers
  • You need to know more than just facts in order to use critical thinking skills.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!