Руководство по стандартной библиотеке шаблонов STL

         

Found 25 at offset


#include <stl.h> #include <iostream.h>

int numbers[10] = { 0, 1, 4, 9, 16, 25, 36, 49, 64 };

int main () { int* location; location = find (numbers, numbers + 10, 25); cout << " Found 25 at offset " << (location - numbers) << endl; return 0; }



#include <stl.h> #include <iostream.h>

int years[] = { 1942, 1952, 1962, 1972, 1982, 1992 };

int main () { const unsigned yearCount = sizeof (years) / sizeof (years[0]); int* location = find (years, years + yearCount, 1972); cout << " Found 1972 at offset " << (location - years) << endl; return 0; }


Содержание раздела