// iterfind.cpp // find() возвращает итератор списка #include #include #include using namespace std; int main() { list theList(5); // пустой список для 5 значений int list::iterator iter; // итератор int data = 0; // заполнение списка данными for(iter = theList.begin(); iter != theList.end(); iter++) *iter = data += 2; //2, 4, 6, 8, 10 // поиск числа 8 iter = find(theList.begin(), theList.end(), 8); if( iter != theList.end() ) cout << "\nНайдено число 8.\n"; else cout << "\nЧисло 8 не найдено.\n"; return 0; }