L.PushBack(“Help”);
L.PushFront(“I”);
L.PushFront(“May”);
L.PushBack(“You”);
You are given the declaration: fsu::List L;
Write a client program fragment that inserts the strings “Help”, “I”, “May”, “You” into L (in this order) so that
L.Display(std::cout, ‘ ‘);
results in the sentence “May I Help You”.
PushFront(t)
[n] (bracket operator)
[n] (bracket operator)
Minimal set of operations that distinguish fsu::Deque from other fsu:: sequential containers.
Insert(i,t)
Minimal set of operations that distinguish fsu::List from other fsu:: sequential containers.
SetSize()
Minimal set of operations that distinguish fsu::Vector from other fsu:: sequential containers.
fsu::Stack < fsu::String , fsu::Vector < fsu::String > > S;
Declare an fsu::Stack object S with elements of type fsu::String and underlying container fsu::Vector.
fsu::Vector widgetVector (15,ZED);
Declare a vector object widgetVector with elements of type Widget, size 15, and initial element values equal to ZED.
fsu::List L;
Declare an fsu::List object L with elements of type fsu::String.
fsu::Deque < String > d
Declare a Deque object d with elements of type String.
fsu::Queue < fsu::String , List < fsu::String > > q;
Declare an fsu::Queue object q with elements of type fsu::String and underlying container fsu::List.
fsu::Vector v;
Declare an fsu::Vector object v with elements of type fsu::String
B
The following represents output from the call d.Dump() from the fsu::Deque object d:
content_[i]: A B C D E F G H I J
i mod 10: 0 1 2 3 4 5 6 7 8 9
e b
What is the result of the output statement
std::cout << d[5];?
True
A function to display the contents of an associative array could be implemented efficiently as follows:
Display(const AssociativeArray& aa)
{
AssociativeArray::Iterator i;
for (i = aa.Begin(); i != aa.End(); ++i)
std::cout << *i.key_ << " : " << *i.data_ << 'n';
}
T or F