76 339
Assignments Done
Successfully Done
In May 2019

Answer to Question #21390 in C++ for Alaa

Question #21390
Implement a function DisplayEven(...) that displays only the even elements inserted by the user. i.e.: element number 0, element number 2, etc.using double linked list
Expert's answer
#include <conio.h>
#include <list>
#include <string>
#include <iostream>

using namespace std;

void DisplayEven(list<string>& lst)
list<string>::iterator i = lst.begin();
for (int c = 0; c < lst.size(); c += 2)
cout << "Element " << c << ": " << *i << endl;
advance(i, 2);

void main()
list<string> lst;
string tmp;

cout << "Enter string values one by one or 'q' to stop:" << endl;
while (true)
getline(cin, tmp);
if (tmp == "q")

cout << endl;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions