Write a program that reads indicating the number of wo Ex: If the input is: 5 hev hi Mark hi ma

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 16RQ
icon
Related questions
Question
Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins with an integer
indicating the number of words that follow. Assume that the list will always contain fewer than 20 words.
Ex: If the input is:
5 hey hi Mark hi mark
the output is:
hey 1
hi 2
-
Mark 1
hi - 2
mark 1
Hint: Use two vectors, one vector for the strings and one vector for the frequencies.
Transcribed Image Text:Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins with an integer indicating the number of words that follow. Assume that the list will always contain fewer than 20 words. Ex: If the input is: 5 hey hi Mark hi mark the output is: hey 1 hi 2 - Mark 1 hi - 2 mark 1 Hint: Use two vectors, one vector for the strings and one vector for the frequencies.
1 #include <iostream>
2 #include <vector>
3 #include <string>
4 using namespace std;
5
6 int main() {
7
8
9
10
11}
12
/* Type your code here. */
return 0;
Transcribed Image Text:1 #include <iostream> 2 #include <vector> 3 #include <string> 4 using namespace std; 5 6 int main() { 7 8 9 10 11} 12 /* Type your code here. */ return 0;
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT