SlideShare a Scribd company logo
(main.cpp)
#include "ListItem.h"
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int main () {
// working with a vector of ints
int myints[] = { 5, 10, 15, 20 };
std::vector<int> vectorOfNums (myints,myints+4);
std::vector<int>::iterator vectItr;
// TODO: write call to find() to search for 15 in the vectorOfNums
if (vectItr != vectorOfNums.end())
std::cout << "Element found: " << *vectItr << 'n';
else
std::cout << "Element not foundn";
// TODO: write call to find() to search for 85 in the vectorOfNums
if (vectItr != vectorOfNums.end())
std::cout << "Element found: " << *vectItr << 'n';
else
std::cout << "Element not foundn";
// working with a list of strings
std::list<std::string> listOfWords;
std::list<std::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
// TODO: write call to find() to search for 'music' in the listOfWords and write
// the code to test for it
// working with a list of listItems
std::list<ListItem> listOfItems;
std::list<ListItem>::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
// 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
return 0;
}
(ListItem.h)
#ifndef LISTITEMH
#define LISTITEMH
#include <string>
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 '<<' overload (hint: must be a friend)
private:
string item;
double price;
};
#endif
(ListIem.cpp)
#include "ListItem.h"
#include <iostream>
ListItem::ListItem() {
item = "";
price = 0.0;
}
ListItem::ListItem(string itemInit, double priceInit) {
item = itemInit;
price = priceInit;
}
// Print this node
void ListItem::PrintNodeData() {
cout << item << ": $" << price << endl;
}
// TODO: write the definition for the '==' overload
// TODO: write the prototype for '<<' overload
Given a Listitem class, complete main() using algorithms from the STL (STL Algorithms). An
example algorithm the find(): find (Inputiterator first, Inputiterator last, const T& val) The find uses
two iterators for the bounds of the search, first and last. The 3rd parameter is the value being
searched for. if we look inside the find() we might see code like this (ref cplusplus.com): The
description of find () states "The function uses operator== to compare the individual elements to
val". This means that any object we want to search for needs to be have the capability of
performing ==. And this may mean implementing the overload if the data type of the object does
not already have this overload. Note that C++ types like int, float, double, and string already
support this. Your task is to follow the prompts in main() and write the code required. For some of
the tests, you will need to provide support for overloaded operators in the Listltem class.
419632.1188960.q3zqy7
Ad

More Related Content

Similar to maincpp include ListItemh include ltstringgt in.pdf (20)

String searching
String searchingString searching
String searching
Russell Childs
 
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String ProcessingDynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Meghaj Mallick
 
Data Structures asdasdasdasdasdasdasdasdasdasd
Data Structures asdasdasdasdasdasdasdasdasdasdData Structures asdasdasdasdasdasdasdasdasdasd
Data Structures asdasdasdasdasdasdasdasdasdasd
abdulrahman39ab
 
Object Oriented Programming (OOP) using C++ - Lecture 5
Object Oriented Programming (OOP) using C++ - Lecture 5Object Oriented Programming (OOP) using C++ - Lecture 5
Object Oriented Programming (OOP) using C++ - Lecture 5
Faculty of Computers and Informatics, Suez Canal University, Ismailia, Egypt
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with Python
Han Lee
 
Implementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docxImplementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docx
RyanEAcTuckern
 
Need help with the TODO's (DONE IN C++) #pragma once #include -funct.pdf
Need help with the TODO's (DONE IN C++) #pragma once   #include -funct.pdfNeed help with the TODO's (DONE IN C++) #pragma once   #include -funct.pdf
Need help with the TODO's (DONE IN C++) #pragma once #include -funct.pdf
actexerode
 
PathOfMostResistance
PathOfMostResistancePathOfMostResistance
PathOfMostResistance
Edward Cleveland
 
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfInspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
vishalateen
 
RTTI and Namespaces.pptx ppt of c++ programming language
RTTI and Namespaces.pptx ppt of c++ programming languageRTTI and Namespaces.pptx ppt of c++ programming language
RTTI and Namespaces.pptx ppt of c++ programming language
ankeshshri
 
Lecture11 standard template-library
Lecture11 standard template-libraryLecture11 standard template-library
Lecture11 standard template-library
Hariz Mustafa
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
HIMANSUKUMAR12
 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdf
aathmaproducts
 
You are required to implement the following functions for doubly linke.docx
You are required to implement the following functions for doubly linke.docxYou are required to implement the following functions for doubly linke.docx
You are required to implement the following functions for doubly linke.docx
Jonathan5GxRossk
 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdf
aathiauto
 
Array and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptxArray and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptx
JumanneChiyanda
 
Given an array nums of size n- return the majority element- The majori.pdf
Given an array nums of size n- return the majority element- The majori.pdfGiven an array nums of size n- return the majority element- The majori.pdf
Given an array nums of size n- return the majority element- The majori.pdf
MattCu9Parrd
 
C++ Secure Programming
C++ Secure ProgrammingC++ Secure Programming
C++ Secure Programming
Marian Marinov
 
C++11 - STL Additions
C++11 - STL AdditionsC++11 - STL Additions
C++11 - STL Additions
GlobalLogic Ukraine
 
Assignment c programming
Assignment c programmingAssignment c programming
Assignment c programming
Icaii Infotech
 
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String ProcessingDynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Meghaj Mallick
 
Data Structures asdasdasdasdasdasdasdasdasdasd
Data Structures asdasdasdasdasdasdasdasdasdasdData Structures asdasdasdasdasdasdasdasdasdasd
Data Structures asdasdasdasdasdasdasdasdasdasd
abdulrahman39ab
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with Python
Han Lee
 
Implementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docxImplementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docx
RyanEAcTuckern
 
Need help with the TODO's (DONE IN C++) #pragma once #include -funct.pdf
Need help with the TODO's (DONE IN C++) #pragma once   #include -funct.pdfNeed help with the TODO's (DONE IN C++) #pragma once   #include -funct.pdf
Need help with the TODO's (DONE IN C++) #pragma once #include -funct.pdf
actexerode
 
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfInspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
vishalateen
 
RTTI and Namespaces.pptx ppt of c++ programming language
RTTI and Namespaces.pptx ppt of c++ programming languageRTTI and Namespaces.pptx ppt of c++ programming language
RTTI and Namespaces.pptx ppt of c++ programming language
ankeshshri
 
Lecture11 standard template-library
Lecture11 standard template-libraryLecture11 standard template-library
Lecture11 standard template-library
Hariz Mustafa
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
HIMANSUKUMAR12
 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdf
aathmaproducts
 
You are required to implement the following functions for doubly linke.docx
You are required to implement the following functions for doubly linke.docxYou are required to implement the following functions for doubly linke.docx
You are required to implement the following functions for doubly linke.docx
Jonathan5GxRossk
 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdf
aathiauto
 
Array and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptxArray and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptx
JumanneChiyanda
 
Given an array nums of size n- return the majority element- The majori.pdf
Given an array nums of size n- return the majority element- The majori.pdfGiven an array nums of size n- return the majority element- The majori.pdf
Given an array nums of size n- return the majority element- The majori.pdf
MattCu9Parrd
 
C++ Secure Programming
C++ Secure ProgrammingC++ Secure Programming
C++ Secure Programming
Marian Marinov
 
Assignment c programming
Assignment c programmingAssignment c programming
Assignment c programming
Icaii Infotech
 

More from abiwarmaa (20)

Data Matrix is Such data set can be represented by a n by.pdf
Data Matrix is  Such data set can be represented by a n by.pdfData Matrix is  Such data set can be represented by a n by.pdf
Data Matrix is Such data set can be represented by a n by.pdf
abiwarmaa
 
Desarrolle un modelo de lienzo de modelo de negocio con det.pdf
Desarrolle un modelo de lienzo de modelo de negocio con det.pdfDesarrolle un modelo de lienzo de modelo de negocio con det.pdf
Desarrolle un modelo de lienzo de modelo de negocio con det.pdf
abiwarmaa
 
Bir hizmet irketi olan Easy Ltd bilano gn dzenlemeleri.pdf
Bir hizmet irketi olan Easy Ltd bilano gn dzenlemeleri.pdfBir hizmet irketi olan Easy Ltd bilano gn dzenlemeleri.pdf
Bir hizmet irketi olan Easy Ltd bilano gn dzenlemeleri.pdf
abiwarmaa
 
Assuming that the user inputs 1524 what does the following .pdf
Assuming that the user inputs 1524 what does the following .pdfAssuming that the user inputs 1524 what does the following .pdf
Assuming that the user inputs 1524 what does the following .pdf
abiwarmaa
 
1Which of the following best describes bryozoans aQuestion.pdf
1Which of the following best describes bryozoans aQuestion.pdf1Which of the following best describes bryozoans aQuestion.pdf
1Which of the following best describes bryozoans aQuestion.pdf
abiwarmaa
 
63 64 Data tablebalance sheet as of June 30 201X ente.pdf
63 64 Data tablebalance sheet as of June 30 201X ente.pdf63 64 Data tablebalance sheet as of June 30 201X ente.pdf
63 64 Data tablebalance sheet as of June 30 201X ente.pdf
abiwarmaa
 
PROBLEM 3 At yearend Myra Company reported cash and cash e.pdf
PROBLEM 3 At yearend Myra Company reported cash and cash e.pdfPROBLEM 3 At yearend Myra Company reported cash and cash e.pdf
PROBLEM 3 At yearend Myra Company reported cash and cash e.pdf
abiwarmaa
 
You are required to use Verilog structural modeling to desig.pdf
You are required to use Verilog structural modeling to desig.pdfYou are required to use Verilog structural modeling to desig.pdf
You are required to use Verilog structural modeling to desig.pdf
abiwarmaa
 
Which of the following statements regarding DUNS is not true.pdf
Which of the following statements regarding DUNS is not true.pdfWhich of the following statements regarding DUNS is not true.pdf
Which of the following statements regarding DUNS is not true.pdf
abiwarmaa
 
What should Jamal propose as a strategy for BlackBerry as a .pdf
What should Jamal propose as a strategy for BlackBerry as a .pdfWhat should Jamal propose as a strategy for BlackBerry as a .pdf
What should Jamal propose as a strategy for BlackBerry as a .pdf
abiwarmaa
 
What is the difference between the SW and OT areas of a SWOT.pdf
What is the difference between the SW and OT areas of a SWOT.pdfWhat is the difference between the SW and OT areas of a SWOT.pdf
What is the difference between the SW and OT areas of a SWOT.pdf
abiwarmaa
 
Use maple 13 to write the code 5 Consider the polar curve r.pdf
Use maple 13 to write the code 5 Consider the polar curve r.pdfUse maple 13 to write the code 5 Consider the polar curve r.pdf
Use maple 13 to write the code 5 Consider the polar curve r.pdf
abiwarmaa
 
The table shown below gives information on a variable for fo.pdf
The table shown below gives information on a variable for fo.pdfThe table shown below gives information on a variable for fo.pdf
The table shown below gives information on a variable for fo.pdf
abiwarmaa
 
Suppose X and Y are independent Paretodistributed with cu.pdf
Suppose X and Y are independent Paretodistributed with cu.pdfSuppose X and Y are independent Paretodistributed with cu.pdf
Suppose X and Y are independent Paretodistributed with cu.pdf
abiwarmaa
 
Real Value Corporation the Company is a public company .pdf
Real Value Corporation the Company is a public company .pdfReal Value Corporation the Company is a public company .pdf
Real Value Corporation the Company is a public company .pdf
abiwarmaa
 
pass but that all but the most sophisticated computer progra.pdf
pass but that all but the most sophisticated computer progra.pdfpass but that all but the most sophisticated computer progra.pdf
pass but that all but the most sophisticated computer progra.pdf
abiwarmaa
 
Nur Inc is a private company that designs manufactures a.pdf
Nur Inc is a private company that designs manufactures a.pdfNur Inc is a private company that designs manufactures a.pdf
Nur Inc is a private company that designs manufactures a.pdf
abiwarmaa
 
MedTex una gran empresa farmacutica con sede en Texas qu.pdf
MedTex una gran empresa farmacutica con sede en Texas qu.pdfMedTex una gran empresa farmacutica con sede en Texas qu.pdf
MedTex una gran empresa farmacutica con sede en Texas qu.pdf
abiwarmaa
 
JS es un hombre de 42 aos que vive en el Medio Oeste y es m.pdf
JS es un hombre de 42 aos que vive en el Medio Oeste y es m.pdfJS es un hombre de 42 aos que vive en el Medio Oeste y es m.pdf
JS es un hombre de 42 aos que vive en el Medio Oeste y es m.pdf
abiwarmaa
 
If we had classified health worker as rich if they earned .pdf
If we had classified health worker as rich if they earned .pdfIf we had classified health worker as rich if they earned .pdf
If we had classified health worker as rich if they earned .pdf
abiwarmaa
 
Data Matrix is Such data set can be represented by a n by.pdf
Data Matrix is  Such data set can be represented by a n by.pdfData Matrix is  Such data set can be represented by a n by.pdf
Data Matrix is Such data set can be represented by a n by.pdf
abiwarmaa
 
Desarrolle un modelo de lienzo de modelo de negocio con det.pdf
Desarrolle un modelo de lienzo de modelo de negocio con det.pdfDesarrolle un modelo de lienzo de modelo de negocio con det.pdf
Desarrolle un modelo de lienzo de modelo de negocio con det.pdf
abiwarmaa
 
Bir hizmet irketi olan Easy Ltd bilano gn dzenlemeleri.pdf
Bir hizmet irketi olan Easy Ltd bilano gn dzenlemeleri.pdfBir hizmet irketi olan Easy Ltd bilano gn dzenlemeleri.pdf
Bir hizmet irketi olan Easy Ltd bilano gn dzenlemeleri.pdf
abiwarmaa
 
Assuming that the user inputs 1524 what does the following .pdf
Assuming that the user inputs 1524 what does the following .pdfAssuming that the user inputs 1524 what does the following .pdf
Assuming that the user inputs 1524 what does the following .pdf
abiwarmaa
 
1Which of the following best describes bryozoans aQuestion.pdf
1Which of the following best describes bryozoans aQuestion.pdf1Which of the following best describes bryozoans aQuestion.pdf
1Which of the following best describes bryozoans aQuestion.pdf
abiwarmaa
 
63 64 Data tablebalance sheet as of June 30 201X ente.pdf
63 64 Data tablebalance sheet as of June 30 201X ente.pdf63 64 Data tablebalance sheet as of June 30 201X ente.pdf
63 64 Data tablebalance sheet as of June 30 201X ente.pdf
abiwarmaa
 
PROBLEM 3 At yearend Myra Company reported cash and cash e.pdf
PROBLEM 3 At yearend Myra Company reported cash and cash e.pdfPROBLEM 3 At yearend Myra Company reported cash and cash e.pdf
PROBLEM 3 At yearend Myra Company reported cash and cash e.pdf
abiwarmaa
 
You are required to use Verilog structural modeling to desig.pdf
You are required to use Verilog structural modeling to desig.pdfYou are required to use Verilog structural modeling to desig.pdf
You are required to use Verilog structural modeling to desig.pdf
abiwarmaa
 
Which of the following statements regarding DUNS is not true.pdf
Which of the following statements regarding DUNS is not true.pdfWhich of the following statements regarding DUNS is not true.pdf
Which of the following statements regarding DUNS is not true.pdf
abiwarmaa
 
What should Jamal propose as a strategy for BlackBerry as a .pdf
What should Jamal propose as a strategy for BlackBerry as a .pdfWhat should Jamal propose as a strategy for BlackBerry as a .pdf
What should Jamal propose as a strategy for BlackBerry as a .pdf
abiwarmaa
 
What is the difference between the SW and OT areas of a SWOT.pdf
What is the difference between the SW and OT areas of a SWOT.pdfWhat is the difference between the SW and OT areas of a SWOT.pdf
What is the difference between the SW and OT areas of a SWOT.pdf
abiwarmaa
 
Use maple 13 to write the code 5 Consider the polar curve r.pdf
Use maple 13 to write the code 5 Consider the polar curve r.pdfUse maple 13 to write the code 5 Consider the polar curve r.pdf
Use maple 13 to write the code 5 Consider the polar curve r.pdf
abiwarmaa
 
The table shown below gives information on a variable for fo.pdf
The table shown below gives information on a variable for fo.pdfThe table shown below gives information on a variable for fo.pdf
The table shown below gives information on a variable for fo.pdf
abiwarmaa
 
Suppose X and Y are independent Paretodistributed with cu.pdf
Suppose X and Y are independent Paretodistributed with cu.pdfSuppose X and Y are independent Paretodistributed with cu.pdf
Suppose X and Y are independent Paretodistributed with cu.pdf
abiwarmaa
 
Real Value Corporation the Company is a public company .pdf
Real Value Corporation the Company is a public company .pdfReal Value Corporation the Company is a public company .pdf
Real Value Corporation the Company is a public company .pdf
abiwarmaa
 
pass but that all but the most sophisticated computer progra.pdf
pass but that all but the most sophisticated computer progra.pdfpass but that all but the most sophisticated computer progra.pdf
pass but that all but the most sophisticated computer progra.pdf
abiwarmaa
 
Nur Inc is a private company that designs manufactures a.pdf
Nur Inc is a private company that designs manufactures a.pdfNur Inc is a private company that designs manufactures a.pdf
Nur Inc is a private company that designs manufactures a.pdf
abiwarmaa
 
MedTex una gran empresa farmacutica con sede en Texas qu.pdf
MedTex una gran empresa farmacutica con sede en Texas qu.pdfMedTex una gran empresa farmacutica con sede en Texas qu.pdf
MedTex una gran empresa farmacutica con sede en Texas qu.pdf
abiwarmaa
 
JS es un hombre de 42 aos que vive en el Medio Oeste y es m.pdf
JS es un hombre de 42 aos que vive en el Medio Oeste y es m.pdfJS es un hombre de 42 aos que vive en el Medio Oeste y es m.pdf
JS es un hombre de 42 aos que vive en el Medio Oeste y es m.pdf
abiwarmaa
 
If we had classified health worker as rich if they earned .pdf
If we had classified health worker as rich if they earned .pdfIf we had classified health worker as rich if they earned .pdf
If we had classified health worker as rich if they earned .pdf
abiwarmaa
 
Ad

Recently uploaded (20)

The History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptxThe History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdfRanking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Rafael Villas B
 
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptxLecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Arshad Shaikh
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
Lecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptxLecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptx
Arshad Shaikh
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
dynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south Indiadynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south India
PrachiSontakke5
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Computer crime and Legal issues Computer crime and Legal issues
Computer crime and Legal issues Computer crime and Legal issuesComputer crime and Legal issues Computer crime and Legal issues
Computer crime and Legal issues Computer crime and Legal issues
Abhijit Bodhe
 
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdfRanking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Rafael Villas B
 
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptxLecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Lecture 2 CLASSIFICATION OF PHYLUM ARTHROPODA UPTO CLASSES & POSITION OF_1.pptx
Arshad Shaikh
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
Lecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptxLecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptx
Arshad Shaikh
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
dynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south Indiadynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south India
PrachiSontakke5
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Computer crime and Legal issues Computer crime and Legal issues
Computer crime and Legal issues Computer crime and Legal issuesComputer crime and Legal issues Computer crime and Legal issues
Computer crime and Legal issues Computer crime and Legal issues
Abhijit Bodhe
 
Ad

maincpp include ListItemh include ltstringgt in.pdf

  • 1. (main.cpp) #include "ListItem.h" #include <string> #include <list> #include <vector> #include <algorithm> #include <iostream> using namespace std; int main () { // working with a vector of ints int myints[] = { 5, 10, 15, 20 }; std::vector<int> vectorOfNums (myints,myints+4); std::vector<int>::iterator vectItr; // TODO: write call to find() to search for 15 in the vectorOfNums if (vectItr != vectorOfNums.end()) std::cout << "Element found: " << *vectItr << 'n'; else std::cout << "Element not foundn"; // TODO: write call to find() to search for 85 in the vectorOfNums if (vectItr != vectorOfNums.end()) std::cout << "Element found: " << *vectItr << 'n'; else std::cout << "Element not foundn"; // working with a list of strings std::list<std::string> listOfWords; std::list<std::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 // TODO: write call to find() to search for 'music' in the listOfWords and write // the code to test for it // working with a list of listItems std::list<ListItem> listOfItems; std::list<ListItem>::iterator listItemIter; listOfItems.push_back(ListItem("shoes", 150.95)); listOfItems.push_back(ListItem("laptop", 1245.85)); listOfItems.push_back(ListItem("dress", 85.68));
  • 2. 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 // 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 return 0; } (ListItem.h) #ifndef LISTITEMH #define LISTITEMH #include <string> 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 '<<' overload (hint: must be a friend) private: string item; double price; }; #endif (ListIem.cpp) #include "ListItem.h" #include <iostream> ListItem::ListItem() { item = ""; price = 0.0; } ListItem::ListItem(string itemInit, double priceInit) { item = itemInit; price = priceInit; } // Print this node
  • 3. void ListItem::PrintNodeData() { cout << item << ": $" << price << endl; } // TODO: write the definition for the '==' overload // TODO: write the prototype for '<<' overload Given a Listitem class, complete main() using algorithms from the STL (STL Algorithms). An example algorithm the find(): find (Inputiterator first, Inputiterator last, const T& val) The find uses two iterators for the bounds of the search, first and last. The 3rd parameter is the value being searched for. if we look inside the find() we might see code like this (ref cplusplus.com): The description of find () states "The function uses operator== to compare the individual elements to val". This means that any object we want to search for needs to be have the capability of performing ==. And this may mean implementing the overload if the data type of the object does not already have this overload. Note that C++ types like int, float, double, and string already support this. Your task is to follow the prompts in main() and write the code required. For some of the tests, you will need to provide support for overloaded operators in the Listltem class. 419632.1188960.q3zqy7