Please help me with this C++ program Create a class that is intended to contain
ID: 657785 • Letter: P
Question
Please help me with this C++ program
Explanation / Answer
I will use a vector to implement the the object. As the object passed through a node. The information about the node would be appended at the end of the vector. the information of a node would be stored in a char, int pair. So the vector will store in order the whole path traversed.
class Store
{
private:
string msg;
pair<char,int> originalLocation;
vector<pair<char,int> > path;
public:
void addNodeInfo(int ch,int num)
{
pair<char,int> temp;
temp=make_pair(ch,num);
path.push_back(temp);
}
void printPath()
{
for(int i=0;i<path.size();i++){
cout<<path[i].first<<path[i].second<<" ";
}
cout<<endl;
}
};
User can know the entire path by calling the printPath() function
// Can you please provide an example test case. What exactly would be provided so that we can test.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.