SlideShare a Scribd company logo
1 of 3
Download to read offline
(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

More Related Content

Similar to maincpp include ListItemh include ltstringgt in.pdf

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 ProcessingMeghaj Mallick
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with PythonHan Lee
 
Implementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docxImplementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docxRyanEAcTuckern
 
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.pdfactexerode
 
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-.pdfvishalateen
 
Lecture11 standard template-library
Lecture11 standard template-libraryLecture11 standard template-library
Lecture11 standard template-libraryHariz Mustafa
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfHIMANSUKUMAR12
 
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.pdfaathmaproducts
 
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.docxJonathan5GxRossk
 
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.pdfaathiauto
 
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.pptxJumanneChiyanda
 
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.pdfMattCu9Parrd
 
C++ Secure Programming
C++ Secure ProgrammingC++ Secure Programming
C++ Secure ProgrammingMarian Marinov
 
Assignment c programming
Assignment c programmingAssignment c programming
Assignment c programmingIcaii Infotech
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdffortmdu
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdffeelinggift
 
Write the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxWrite the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxkarlynwih
 

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

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
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with Python
 
Implementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docxImplementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docx
 
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
 
PathOfMostResistance
PathOfMostResistancePathOfMostResistance
PathOfMostResistance
 
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
 
Lecture11 standard template-library
Lecture11 standard template-libraryLecture11 standard template-library
Lecture11 standard template-library
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
 
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
 
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
 
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
 
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
 
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
 
C++ Secure Programming
C++ Secure ProgrammingC++ Secure Programming
C++ Secure Programming
 
C++11 - STL Additions
C++11 - STL AdditionsC++11 - STL Additions
C++11 - STL Additions
 
Assignment c programming
Assignment c programmingAssignment c programming
Assignment c programming
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
 
강의자료10
강의자료10강의자료10
강의자료10
 
Write the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxWrite the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docx
 

More from 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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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 .pdfabiwarmaa
 
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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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 .pdfabiwarmaa
 
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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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 .pdfabiwarmaa
 
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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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.pdfabiwarmaa
 
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 .pdfabiwarmaa
 

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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 

Recently uploaded (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 

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