Please can you help me with the following question?

An iterative version of the C++ function TransactionList::getTransactionsForDate is given below. It can be applied to any list of transactions and returns the list of all the transactions for the given date. It only works when the date given is valid.
Write an equivalent recursive version of that function so that it can be used in the same way and produces the same result.

TransactionList TransactionList::getTransactionsForDate( 
                                           const Date& date) const {
    assert ( date.isValid()); 
    TransactionList copyTrl( *this);
    TransactionList tempTrl;
    while ( ! copyTrl.isEmpty() )
    {
        if ( copyTrl.first().getDate() == date)
            tempTrl.addAtEnd( first());
        copyTrl.deleteFirst();
    }
    return tempTrl;
}

Please can you help me with the following question?

An iterative version of the C++ function TransactionList::getTransactionsForDate is given below. It can be applied to any list of transactions and returns the list of all the transactions for the given date. It only works when the date given is valid.
Write an equivalent recursive version of that function so that it can be used in the same way and produces the same result.

I added these tags for you

TransactionList TransactionList::getTransactionsForDate( const Date& date) const {
	assert ( date.isValid()); 
	TransactionList copyTrl( *this);
	TransactionList tempTrl;
	while ( ! copyTrl.isEmpty() )
	{
		if ( copyTrl.first().getDate() == date)
			tempTrl.addAtEnd( first());
		copyTrl.deleteFirst();
	}
	return tempTrl;

}

I'll help you first by saying this isn't your first post, it's your 11th, you should know how to use code tags by now. You should also know that we don't give help to those who don't show effort.

commented: It's getting tiresome isn't it? +36
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.