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

C++ code thats need to be commented, needing help ? this is an edit for a phoneb

ID: 3692828 • Letter: C

Question

C++ code thats need to be commented, needing help ? this is an edit for a phonebook code....

#include "Edit.h"

Edit::Edit()
{
searchName = " ";
newName = " ";
}

Edit::Edit(string sn, string nn)
{
searchName = sn;
newName = nn;
}

Edit::~Edit()
{

}

string Edit::getSearchName() const
{
return searchName;
}

string Edit::getNewName() const
{
return newName;
}

void Edit::setSearchName(string n)
{
searchName = n;
}

void Edit::setNewName(string nn)
{
newName = nn;
}


void Edit::editFunction(vector<Contacts>& myVec)
{
string findName, newName, newNum;

cout << " Which Contact Would You Like to Edit? ";
cin >> findName;

for(unsigned int i = 0; i < myVec.size(); i++)
{
if (myVec[i].getName() == findName)
{
cout << " Success Found Contact: " << myVec[i].getName()
<< " " << myVec[i].getMobNumber() << endl;

cout << " Enter New Name: ";
cin >> newName;
cout << " And Number... ";
cin >> newNum;
myVec[i].setName(newName);
myVec[i].setMobNumber(newNum);
Sleep(1000);
cout << " *Success Contact Has Been Edited*";
return;
}
else { cout << " Sorry Contact Not Found" << endl; }
}
}

Explanation / Answer

This is tested in cpp.sh

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