Code:
#include <algorithm>
#include <iostream>
#include <list>
#include <string>
int main()
{
int array[ 17 ] = { 7,3,3,7,6,5,8,7,2,1,3,8,7,3,8,4,3 };
int elem = array[ 9 ];
int *found_it;
found_it = std::find( &array[0], &array[17], elem );
// печатается: поиск первого вхождения 1 найдено!
std::cout << "поиск первого вхождения "
<< elem <<"\t"
<< ( found_it ? "найдено!\n" : "не найдено!\n" );
std::string beethoven[] = {
"Sonata31", "Sonata32", "Quartet14", "Quartet15",
"Archduke", "Symphony7" };
std::string s_elem( beethoven[ 1 ] );
std::list< std::string, std::allocator > slist( beethoven, beethoven+6 );
std::list< std::string, std::allocator >::iterator iter;
iter = find( slist.begin(), slist.end(), s_elem );
// печатается: поиск первого вхождения Sonata32 найдено!
std::cout << "поиск первого вхождения "
<< s_elem << "\t"
<< ( found_it ? "найдено!\n" : "не найдено!\n" );
}
The code from the internet, it's nonsense, or is it?
std::list< std::string, std::allocator > slist( beethoven, beethoven+6 );&&????????