Question: I am writing a c++ program that uses the find() to find various elements using overload operators when I run the program am getting these

I am writing a c++ program that uses the find() to find various elements using overload operators

when I run the program am getting these errors. Is there any way to fix this?

I am writing a c++ program that uses the find() to find

--mycode--

--main.cpp--

#include "ListItem.h" #include #include #include #include #include

using namespace std;

int main () {

// working with a vector of ints int myints[] = { 5, 10, 15, 20 }; std::vector vectorOfNums (myints,myints+4); std::vector::iterator vectItr;

// TODO: write call to find() to search for 15 in the vectorOfNums

vectItr = std::find (vectorOfNums.begin(), vectorOfNums.end(), 15);

if (vectItr != vectorOfNums.end()) std::cout

// TODO: write call to find() to search for 85 in the vectorOfNums

vectItr = std::find (vectorOfNums.begin(), vectorOfNums.end(), 85);

if (vectItr != vectorOfNums.end()) std::cout

// working with a list of strings std::list<:string> listOfWords; std::list<:string>::iterator listIter;

listOfWords.push_back("house"); listOfWords.push_back("cup"); listOfWords.push_back("car"); listOfWords.push_back("lamp");

// TODO: write call to find() to search for 'lamp' in the listOfWords and write // the code to test for it

listIter = find (listOfWords.begin(), listOfWords.end(), "lamp");

if (listIter != listOfWords.end()) std::cout

// TODO: write call to find() to search for 'music' in the listOfWords and write // the code to test for it

listIter = find (listOfWords.begin(), listOfWords.end(), "music");

if (listIter != listOfWords.end()) std::cout

// working with a list of listItems std::list listOfItems; std::list::iterator listItemIter;

listOfItems.push_back(ListItem("shoes", 150.95)); listOfItems.push_back(ListItem("laptop", 1245.85)); listOfItems.push_back(ListItem("dress", 85.68)); listOfItems.push_back(ListItem("polo shirt", 25.67));

// TODO: write call to find() to search for the 'dress' object in the listOfItems and write // the code to test for it

listItemIter = find (listOfItems.begin(), listOfItems.end(), ["dress", 85.68] );

if (listItemIter != listOfItems.end()) std::cout

// TODO: write call to find() to search for the 'slacks' object that cost '85.68' in the listOfItems and write // the code to test for it

listItemIter = find (listOfItems.begin(), listOfItems.end(), ["slacks", 85.68] );

if (listItemIter != listOfItems.end()) std::cout

return 0; } --Listitem.h--

#ifndef LISTITEMH #define LISTITEMH

#include

using namespace std;

class ListItem { public: ListItem();

ListItem(string itemInit, double priceInit);

// Print this node void PrintNodeData();

// TODO: write the prototype for the '==' overload

// TODO: write the prototype for '

private: string item; double price; };

#endif

--Listitem.cpp--

#include "ListItem.h" #include

ListItem::ListItem() { item = ""; price = 0.0; }

ListItem::ListItem(string itemInit, double priceInit) { item = itemInit; price = priceInit; }

// Print this node void ListItem::PrintNodeData() { cout

// TODO: write the definition for the '==' overload

// TODO: write the prototype for '

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!