I am having hard time understanding this

24 views Asked by At

I have been giving two header files with the template for each and it asking

Write a bag member function with two parameters. The two parameters are Items x and y. The function should write to the console all Items in the bag that are between the first occurrence of x and the first occurrence of y. You may assume that items can be compared for equality using ==. Use the following header for the function:

    void print_value_range(const Item& x, const Item& y);

print_value_range can be interpreted in a number of ways, but use the following points.

This should make the implementation a little easier.

  • Print the Items from x to y including the start but not including the end.
  • If there is no element in the bag that has value x, print nothing
  • Otherwise, if there is no element in the bag, after x, that has the value y, then print from x to the end of the list
  • Print the values on one line separated by space. Put an end of line after the values are all printed.

Remove Repetitions

Write a member function that deletes all repetitions from the bag. In your implementation, assume that items can be compared for equality using ==. Use the following header for the function: void remove_repetitions() Here is a brief outline of an algorithm:

  • A node pointer p steps through the bag
  • For each Item, define a new pointer q equal to p
  • While the q is not the last Item in the bag ◼ If the next Item has data equal to the data in p, remove the next Item ◼ Otherwise move q to the next Item in the bag
  1. Write a new test program to test the above two member functions. Submitting Assignment

The giving headers are node2 and bag5 with each one template

bag5.h has include node2.h in it and it has these lines

  void print_value_range(const Item& x, const Item& y); //<-- Implement this!!!!!
    void remove_repetitions(); //<-- Implement this!!!!!

my question is where do i implement these in which header or in another file or in template or what

0

There are 0 answers