Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Why isn't this function working?? Please Help. If info[0] = 5 and the item in the parameter is 5, the function isn't recognizing the that

Why isn't this function working?? Please Help.

If info[0] = 5 and the item in the parameter is 5, the function isn't recognizing the that both variables are the same.

this is how info was set

info = new ItemType[Max_Items];

template < class ItemType > int UnsortedList < ItemType >::findIndex (ItemType item) const //Searches the list for item and returns itembs index if the item was found. { ItemType vari; int index = 0; for (int i = 0; i < Max_Items; i++) { vari = item; cout << "vari: " << vari << " item: "<< item << " "; if (vari == info[i]) { index = i; } else { index = -1; } } return index; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions

Question

Explain the nature of human resource management.

Answered: 1 week ago

Question

Write a note on Quality circles.

Answered: 1 week ago

Question

Describe how to measure the quality of work life.

Answered: 1 week ago

Question

7. Where Do We Begin?

Answered: 1 week ago