Create a class that is intended to contain the following information: = ... Wher
ID: 657497 • Letter: C
Question
Create a class that is intended to contain the following information: = ... Where is a transmission And ... are locations through which the message has been passed with Ln being the final destination. L1 through Ln are char/int pairs such as 'B4' or 'S74'. is a message (string) is the origination location (a char/int pair such as 'A3') Justify how you will construct the object, what (if any) STL templates you will use, describe how you will test this object, list a number of test cases for it, and then create a test driver that loads all those test cases and presents their results to the screen. This will allow a user at location Ln to know the entire path a transmission follows from the point of origin.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;
vector<pair<int,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;
}
};
// 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.