listtest6.cpp

来自「VC.net 的一些有用的技巧」· C++ 代码 · 共 24 行

CPP
24
字号
#include <list>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std ;
typedef list<string> LISTSTR;

int main()
{
    	LISTSTR Fruit;
	LISTSTR::iterator FruitIterator;
	Fruit.push_back("Apple");
	Fruit.push_back("Orange");
	Fruit.push_back("Pear");
	FruitIterator = find (Fruit.begin(), Fruit.end(), "Apple");
	if (FruitIterator == Fruit.end())
	{ 
		cout << "No Apple in the list" << endl;
	} 
	else 
	{
		cout <<	*FruitIterator<< endl;
	} 
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?