?? chapter6-15.cpp
字號(hào):
//文件名:].cpp
#pragma warning(disable:4786)
#include <string>
#include <vector>
#include <algorithm>
#include <iostream.h>
using namespace std;
class EventIsIn1997
{public:
bool operator () (string& EventRecord)
{return EventRecord.substr(12,4)=="1997";}
};
void main (void)
{
vector<string> Events;
Events.push_back("07 January 1995 Draft plan of house prepared");
Events.push_back("07 February 1996 Detailed plan of house prepared");
Events.push_back("10 January 1997 Client agrees to job");
Events.push_back("15 January 1997 Builder starts work on bedroom");
Events.push_back("30 April 1997 Builder finishes work");
vector<string>::iterator EventIterator =find_if (Events.begin(), Events.end(), EventIsIn1997());
if (EventIterator==Events.end()) { cout << "Event not found in vector" << endl; }
else {cout << "Event found in vector" << endl; }
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -