Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me correct this code to compile correctly. I am using Dev C++ and am

ID: 3568116 • Letter: P

Question

Please help me correct this code to compile correctly. I am using Dev C++ and am getting many errrors.

The program implements a class Person with the following fields:

-the name

-a pointer to the person's best friend (a Person*)

-a popularity counter to indicate how many people have this person as their best friend.

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>

using namespace std;

int main()
{
  
   class Person
   {
      
       public:
       char name [30];
       Person *BestFriend;
       string best;
       int popularity_counter;
      
       Person()
       {
           popularity_counter=0;
           BestFriend=NULL;
          
       }
};
      
std::vector<</b>Person*>::first;
std::vector<</b>Person*>::second;
Person * UpdateFriendCount(char *name);
vector<</b>Person*> PersonVector;
void TakeInputs();
{
  
   cout<<"Enter name of person";
   for (int i=0; i<</b>5; i++)
   {
       Person* p1=new Person();
       cout<<"Enter"<<i+1<<"name of person ";
       cin>>p1->name;
       PersonVector.push_back(p1);  
   }
  
   for (it1=PersonVector.begin();it1<</b>PersonVector.end();it1++)
   {
       char Bfrnd[30];
       cout<<"Enter"<<(*it1)->name<<"best friend name is ";
       cin>>Bfrnd;
       (*it1)->BestFriend=UpdatedFriendCount(Bfrnd);
       if ((*it1)->BestFriend->name==NULL)
       (*it1)->best=Bfrnd;
   }
}
  
Person * UpdateFriendCount(char *name)  
{
   for(it2=PersonVector.begin();it1<</b>PersonVector.end();it2++)
   {
       if(strcmp((*it2)->name,name)==0)
       {
           (*it2)->popularity_counter++;
           return *it2;
       }
       cout<<"Name "<<it1->name;
   }
   return NULL;
}
void DisplayDetails(void)
{
   cout<<"Person";
   for(it1=PersonVector.begin();it1<</b>PersonVector.end();it1++)
   {
       cout<<"Name "<<(*it1)->name;
       if((*it1)->BestFriend->name!=NULL)
       cout<<"Best friends name is " <<(*it1)->best;
       cout<<"Count "<<(*it1)->popularity_counter<<"";
   }
}

Explanation / Answer

100% Fresh answer, guaranteed to get you best grades possible. Just check it out: http://programmingtutor3.tk/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote