Różnice między wybraną wersją a wersją aktualną.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
count_count_if [2008/12/11 18:42] abartcza |
count_count_if [2008/12/12 00:03] (aktualna) abartcza |
||
|---|---|---|---|
| Linia 8: | Linia 8: | ||
| ===== Opis algorytmu count ===== | ===== Opis algorytmu count ===== | ||
| - | === Deklaracja algorytmu count === | + | === Definicja algorytmu count === |
| <code cpp> template <class InputIterator, class T> | <code cpp> template <class InputIterator, class T> | ||
| ptrdiff_t count ( InputIterator first, InputIterator last, const T& value ) | ptrdiff_t count ( InputIterator first, InputIterator last, const T& value ) | ||
| Linia 74: | Linia 74: | ||
| ===== Opis algorytmu count_if ===== | ===== Opis algorytmu count_if ===== | ||
| - | === Deklaracja algorytmu count_if === | + | === Definicja algorytmu count_if === |
| <code cpp> template <class InputIterator, class Predicate> | <code cpp> template <class InputIterator, class Predicate> | ||
| ptrdiff_t count_if ( InputIterator first, InputIterator last, Predicate pred ) | ptrdiff_t count_if ( InputIterator first, InputIterator last, Predicate pred ) | ||
| Linia 115: | Linia 115: | ||
| int main() { | int main() { | ||
| - | typedef vector<string> VectorString; | + | // tutaj odpowiednie deklaracje ... |
| - | + | ||
| - | typedef VectorString::iterator VectorStringIt; | + | |
| - | + | ||
| - | // wektor imion | + | |
| - | VectorString vect; | + | |
| - | + | ||
| - | // iteratory wskazujace na wektor imion vect | + | |
| - | VectorStringIt start, end; | + | |
| - | + | ||
| - | // zmienna zawierająca liczbę elementów pasująca do danego wzroca | + | |
| - | ptrdiff_t result; | + | |
| - | + | ||
| // przykladowy napis ktory jest wypelniony polskimi imionami, odzielony znakami | // przykladowy napis ktory jest wypelniony polskimi imionami, odzielony znakami | ||
| // które nie są literami alfabetu (separatorami). W imionach nie należy wstawiać | // które nie są literami alfabetu (separatorami). W imionach nie należy wstawiać | ||