I want to ask for help to complete my C++ project. The question is about reading from a text file that contains a story with 18 names. The names repeat a lot in the story. The program should count the repeating names.
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
int main()
{
    ifstream in("Romeo and Juliet.txt");
    ofstream out;
    string name[] = {"Escalus","Paris","Montague","Capulet","Romeo","Tybalt",
                     "Mercutio","Benvolio","Friar Laurence","Friar 
                      John","Balthasar","Abram","Sampson","Gregory",
                      "Peter","Lady Montague","Lady Capulet","Juliet"};
    string str;
    int scount=0,v[18];
    for(int i=0;i<18;i++)
    {
     scount=0;
        while(!in.eof())
       {
           while(getline(in,str))
           {
               if(str==name[i])
               {
                   scount++;
               }
           }
       }
        v[i]=scount;
    }
      for(int i=0;i<18;i++)
      {
         cout<<v[i]<<endl;
      }
       in.close();
 }
 
     
     
    