Page 1 of 1

solve this DLL question with use class not struct in c++ Find and Replace Write the nonmember function int replaceVal(DL

Posted: Thu May 05, 2022 12:58 pm
by answerhappygod
solve this DLL question with use class not struct in c++
Find and Replace
Write the nonmember function int
replaceVal(DLList<T> &list, T f, T r) which
replaces every occurrence of the value f in the list with the value
r. The function should also return the total number of
replacements.
Example:
If the list myList has [ 7, 3, 5, 7, 7, 3, 8,
3]
then after calling
replaceVal(myList, 7, 5);
myList will contain [ 5, 3, 5,
5, 5, 3, 8, 3]
The function returns 3.