kennen:lib:accumulate
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
— | kennen:lib:accumulate [2019-11-20 14:20] (aktuell) – angelegt - Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== accumulate() ====== | ||
+ | ''# | ||
+ | |||
+ | <code cpp> | ||
+ | T accumulate (In first, In last, T startwert) | ||
+ | T accumulate (In first, In last, T startwert, Binary op) | ||
+ | </ | ||
+ | | ||
+ | |||
+ | <code cpp> | ||
+ | | ||
+ | </ | ||
+ | bzw. führt eine " | ||
+ | |||
+ | <code cpp> | ||
+ | x1 x2 x3 | ||
+ | | | ||
+ | v | ||
+ | | ||
+ | </ | ||
+ | ==== Parameter ==== | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | ==== Ergebnis ==== | ||
+ | Rückgabewert: | ||
+ | bei leerem Bereich der '' | ||
+ | |||
+ | ==== Siehe auch ==== | ||
+ | [[for_each]], | ||
+ | [[reduce]], | ||
+ | [[..: | ||
+ | |||
+ | ==== Beispiel ==== | ||
+ | <code cpp accumulate.cpp> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | double arr[] = { 1, 2, 3, 4, 5 }; | ||
+ | std::cout << " | ||
+ | << std:: | ||
+ | std::cout << " | ||
+ | << std:: | ||
+ | } | ||
+ | </ | ||