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
25 POINTS + BRAINLIEST PLS HELPWhere should you put the argument for a command?
Maslowich

d. on. the. line. just. after the. command

8 0
3 years ago
Which technology will a business use to figure out who accessed confidential files on a company's computer system
Charra [1.4K]

Answer:

insaj cdsjl ljhwbalfhb

Explanation:

8 0
3 years ago
Please convert 5AE into decimal​ fast
MaRussiya [10]

Answer:

it could be decimal or hexadecimal

7 0
4 years ago
Which task manager tab allows a user to see how much memory an application has allocated to it that is not available to other pr
Reptile [31]
It will be the processes tab.
7 0
4 years ago
Which of the following is a valid definition of the derived class bClass? a. class bClass::aClass { //... } b. class bClass: pub
Tanya [424]

Answer:  

The answer to the given question is the option "b".  

Explanation:  

In the question option b is correct. It is given that class bClass is a derived class that inherits the base class that is aClass. In the c++ programming language we use the (:) for the perform in inheritance. "Driving a new class from an old class is called inheritance". and other options are not correct that can be described as follows:

  • In option (a) and option(c) the scope resolution operator is used, The scope resolution operator does not use for the single level inheritance it is used for declaring the outline function as well as it is also used for initialized the static variable.That.s why the option(a) and option(c) is incorrect.  
  • In the option(d) the base class i.e "aClass" inherit the derived class i.e "bClass " this is wrong so this option is incorrect

That's why the option "b" is correct.

5 0
4 years ago
Other questions:
  • Which payment type is best if you are trying to sick to a budget?
    15·1 answer
  • You have just used a command that produced some interesting output on the screen. You would like to save that information into a
    10·1 answer
  • Which section in a slide is not visible to the viewers of a presentation, but is visible to the presenter in the normal Slide vi
    13·1 answer
  • Which of these is an.optical medium of storage?
    9·1 answer
  • This finding maximum number function will keep on going until we reach at the last value
    12·1 answer
  • Which of the following is an example of metadata about a webpage?
    7·2 answers
  • An intruder with malicious intent breaks into an office and steals a hard drive containing sensitive information about the compa
    12·1 answer
  • Select all that apply.<br> What two things can you do to display the entire contents of a cell?
    12·1 answer
  • When testing a game, why might you consider throttling the game’s “frames per second”?
    9·1 answer
  • Alex can't play his newest video game on his desktop computer because his video card is too slow. Alex needs to install a video
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!