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
Taya2010 [7]
2 years ago
11

Word frequencies - functions

Computers and Technology
1 answer:
Nuetrik [128]2 years ago
5 0

Answer:

#include <iostream>

#include <vector>

#include <iomanip>

#include <string.h>

#include <string>

#include <algorithm>

using namespace std;

bool strEqual(const string& str1, const string& str2)

{

 //check each characters by case insensitive  

 return std::equal(str1.begin(), str1.end(),

                     str2.begin(), str2.end(),

                     [](char str1, char str2) {

                         return tolower(str1) == tolower(str2);

                     });

}

unsigned GetWordFrequency(vector<string>& vec,const string& str)

{

 //return the number of occurrences of the search word in the

 unsigned res=0;//the numbers of occurences

 for(auto itr:vec)

   {

     if(strEqual(itr,str))

       res++;

   }

 return res;

}

int main()

{

 int size=0;

 cin>>size;

 vector<string>vec;

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

   {

     string str;

     cin>>str;

     vec.push_back(str);

   }

   cout<<"Output:"<<endl;

 for(auto itr: vec)

   {

     cout<<itr<<" - "<<GetWordFrequency(vec,itr)<<endl;

   }

 return 0;

}

Explanation:

You might be interested in
Which of the following statements is true of a server? Question 18 options: A) It supports processing requests from remote compu
TiliK225 [7]

Answer:

Option (A) is the correct answer of this question.

Explanation:

The server supports the processing requests from the remote computers. A system is a device built to accommodate inquiries from many other external systems and customers to execute transactions. Employees are called private computer ,tablets, including phones which connect websites.

Network resources are handled through servers.The server is a software application or tool providing a service to some other software program and its customer, also identified as those of the user.

Other options are incorrect because they are not related to the given scenario.

5 0
3 years ago
Please help!
Darya [45]
The answer would be A.) Web pages provide information, while web applications allow the user to do something. a web page is for relaying information. (you can relate this to a book. a page in a book gives you information.) while an application allows you to perform an action.
4 0
3 years ago
Read 2 more answers
Your car's engine, transmission, power steering, and brakes all require __________ inspection and changes.
kvasek [131]

The answer is C


All parts require fluid

4 0
3 years ago
Read 2 more answers
Client computers cannot function unless they are connected to the network because they cannot access an operating system.
Shtirlitz [24]

Answer: true

Explanation:

As the operating system cannot run from an external device and in a distributed operating system all the clients needs to be connected to the network to share resources via the distributed or network operating system.

8 0
3 years ago
What is redundancy? What problems are associated with redundancy?
Anarel [89]

Answer:

Redundancy is the mechanism that occurs in database's data as the same data is stores in the multiple location.It creates repeated data by accident or for backup purpose.

The issues that arise due to the redundancy of the data is the storage space in database gets consumed and thus wastes the space in storing information in multiple locations.When any update occurs in the stored data's field value , it also has to be changed in the multiples occurrences.

5 0
4 years ago
Other questions:
  • Days of the week are represented as three-letter strings ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"). Write a javaScript f
    14·1 answer
  • Using Python
    14·1 answer
  • Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins with a
    13·1 answer
  • Gina is driving her car down the street. She has a teddy bear sitting on the back seat. A dog runs in front of Gina's car, so sh
    15·2 answers
  • Write a CPP Program to read an integer number. Use a pointer to display this numbe
    5·1 answer
  • What Word features allow you to copy multiple paragraph formatting syles
    5·1 answer
  • When backing up a database, what is added to the file name?<br> On g metrix
    9·1 answer
  • Hi who plays among us
    9·1 answer
  • When hacking a website to test a secure connection and ensure internet safety, what is a good way to check the coding of the web
    14·1 answer
  • Help plz (will give brainliest)
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!