Welcome! Log In Create A New Profile

Advanced

Question 7 Assig 2

Posted by sombu 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Question 7 Assig 2
May 12, 2008 09:37AM
The header for function in question 7 should be:

Template< class Type >
Void replaceItem ( queueType<int> & queue, int oldItem, int newItem)
Re: Question 7 Assig 2
May 12, 2008 08:54PM
What exactly are they asking us when they say "replaces each copy of an item in a queue" ??
Does that mean that if my queue is { 3 4 3 5 6 7 8 9 } I will replace one of the 3's with something else?
Which just doesn't seem right.

The word that is throwing me off is "copy", copies of what?

/*********** edited **************/
Ah, never mind. I've looked at the function header, and finally understood.
Basically search through queue and replace all occurences int oldItem with int newItem.

Makes sense now smiling smiley

Just badly worded.
Personally I think the correct Header is as follows
template<class Type>
void replaceItem(queueType<Type> &queue, Type oldItem, Type newItem);

If they were all working as int data types template <class Type> would be pointless.
Re: Question 7 Assig 2
May 13, 2008 09:03AM
Yes you are right.We will accept two headers:

void replaceItem ( queueType<int> & queue, int oldItem, int newItem)


or

template<class Type>
void replaceItem(queueType<Type> &queue, Type oldItem, Type newItem);

regards
Lazarus Aron
Sorry, only registered users may post in this forum.

Click here to login