NEED HELP C++ FAST REALLY /* Bill Wohlleber Exercise 6-8 This program will show
ID: 3720228 • Letter: N
Question
NEED HELP C++ FAST REALLY
/* Bill Wohlleber
Exercise 6-8
This program will show a deque
*/
#include<iostream>
#include<deque>
#include<iterator>
#include<algorithm>
#include<string>
using namespace std;
void main()
{
// declare a deque of string movies and iterator to the deque
// input "Intensity", "Back to the Future", "Planet of the Apes", "Killer Klowns from Outerspace"
// put them in that order but put them in a sorted order as you put them in the deque
// print each movie string from beginning to end with the iterator
// find Killer Klowns from Outerspace
// print from Killer Klowns from Outerspace to the end with iterator
}
Explanation / Answer
#include<iostream>
#include<deque>
#include<iterator>
#include<algorithm>
#include<string>
using namespace std;
using namespace std;
int main()
{
// declare a deque of string movies and iterator to the deque
deque <string> gquiz;
deque <string> :: iterator it;
for (it = gquiz.begin(); it != gquiz.end(); ++it)
{
cout << ' ' << *it;
cout << ' ';
}
// input "Intensity", "Back to the Future", "Planet of the Apes", "Killer Klowns from Outerspace"
gquiz.push_back("Intensity");
gquiz.push_back("Back to the Future");
gquiz.push_back("Planet of the Apes");
gquiz.push_back("Killer Klowns from Outerspace");
// put them in that order but put them in a sorted order as you put them in the deque
sort (gquiz.begin(), gquiz.end());
// print each movie string from beginning to end with the iterator
for (it = gquiz.begin(); it != gquiz.end(); ++it)
{
cout<< *it;
cout << ' ';
}
return 0;
}
---------------------
output sample :-
Back to the Future
Intensity
Killer Klowns from Outerspace
Planet of the Apes
---------------------------------------------------------------------------------------------
If you have any query, please feel free to ask.
Thanks a lot.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.