Mega Code Archive

 
Categories / C++ / Deque
 

Search across two deques

#include <iostream> #include <deque> #include <algorithm> #include <string> using namespace std; int main() {   deque<string> log;   deque<string> break_in;   deque<string>::iterator itr;   break_in.push_back("A");   break_in.push_back("B");   break_in.push_back("C");   break_in.push_back("D");   break_in.push_back("E");   log.push_back("q");   log.push_back("w");   log.push_back("e");   log.push_back("r");   log.push_back("t");   log.push_back("y");   log.push_back("u");   for(itr = log.begin(); itr != log.end(); ++itr)     cout << *itr << endl;   itr = search(log.begin(), log.end(), break_in.begin(), break_in.end());   if(itr != log.end())     cout << endl << "Possible attempted break-in found." << endl;   else     cout << endl << "No repeated password failures found." << endl;   return 0; }