当前位置: 首页>>代码示例>>C++>>正文


C++ Events::Add方法代码示例

本文整理汇总了C++中Events::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ Events::Add方法的具体用法?C++ Events::Add怎么用?C++ Events::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Events的用法示例。


在下文中一共展示了Events::Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(){
	system("chcp 1251 > nul");

	list<double> l1(2);
	list<double> l2(4, 5);
	list<double> l3(l2);
	list<double> l4;

	lPrint(l2);
	for (int i = 0; i < 6; ++i){
		l4.push_back(9.0034 + i);
	}

	int i = 0;
	for (list<double>::iterator it = l4.begin(); it != l4.end(); ++it){
		cout << "l(" << i++ << ") = " << *it << endl;
	}

	cout << endl;

	l4.push_front(0.234);
	lPrint(l4);
	cout << '\n';
	LPrint<double>(l4);
	cout << endl;

	double_list l5;
	l5.assign(l4.begin(), l4.end());
	lPrint(l5);

	cout << endl;
	double_list::iterator iter;
	iter = l5.begin();
	l5.insert(iter, 65.5434);
	lPrint(l5);

	cout << endl;
	l5.erase(iter);
	lPrint(l5);
	l5.remove(65.5434);
	cout << endl;
	lPrint(l5);

	cout << endl;
	l5.remove_if(is_greater_ten);
	lPrint(l5);

	cout << "\nSorting\n";

	l4.sort();
	l4.sort(less<double>());
	lPrint(l4);
	cout << endl;
	l4.sort(greater);
	lPrint(l4);

	cout << "\nIs list empty? " << ((l4.empty()) ? "Yes" : "No") << endl;

	l4.clear();

	cout << "Is list empty? " << ((l4.empty()) ? "Yes" : "No") << endl;

	std::list<Event<>*> myList;
	myList.push_back(new Event<>("Тест 1", "Москва", 0, EVENT_TYPE_CONFERENCE));
	myList.push_back(new Event<>("Тест 2", "Москва", 0, EVENT_TYPE_CONFERENCE));

	myList.reverse();

	for (auto i = myList.begin(); i != myList.end(); ++i) {
		cout << **i << endl;
	}

	myList.sort(comp);
	myList.remove_if(is_test);
	myList.reverse();
	myList.insert(myList.begin(), new Event<>("Тест 3", "Москва", 0, EVENT_TYPE_CONFERENCE));
	myList.pop_front();
	myList.erase(myList.begin());
	myList.push_back(new Event<>("Тест 4", "Москва", 0, EVENT_TYPE_CONFERENCE));
	myList.clear();

	cout << "Is list empty? " << ((myList.empty()) ? "Yes" : "No") << endl;

	CObList list;
	list.AddTail(new Event<>("Тест 1", "Москва", 0, EVENT_TYPE_CONFERENCE));
	list.AddTail(new Event<>("Тест 2", "Москва", 0, EVENT_TYPE_CONFERENCE));
	list.AddHead(new Event<>("Тест 3", "Москва", 0, EVENT_TYPE_CONFERENCE));
	list.InsertAfter(list.GetHeadPosition(), new Event<>("Тест 4", "Москва", 0, EVENT_TYPE_CONFERENCE));
	list.InsertBefore(list.GetTailPosition(), new Event<>("Тест 5", "Москва", 0, EVENT_TYPE_CONFERENCE));

	POSITION pos;
	for (pos = list.GetHeadPosition(); pos != NULL;)
	{
		cout << *((Event<>*) list.GetNext(pos)) << endl << endl;
	}

	for (pos = list.GetTailPosition(); pos != NULL;)
	{
		cout << *((Event<>*) list.GetPrev(pos)) << endl << endl;
	}
//.........这里部分代码省略.........
开发者ID:lukaville,项目名称:bmstu-lb-2014,代码行数:101,代码来源:lab8.cpp


注:本文中的Events::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。