к заменить их собственными опе
Автор admin
Среда, 3 июня 2009 11:32
к заменить их собственными операциями. //: C06:NumericTest.cpp linclude linclude linclude linclude functional> linclude linclude “PrintSequence.h” using namespace std: int mainO { int a[] = { 1. 1. 2. 2. 3, 5. 7. 9. 11. 13 }: const int ASZ = sizeof a / sizeof a[0]; print(a. a + ASZ. “a”. ” “): int r = accumulated, a + ASZ. 0): cout « “accumulate 1: ” « r « endl; // С тем же результатом: г = accumulated, а + ASZ. 0. plus0): cout « “accumulate 2: ” « r « endl: int b[] = { 1. 2. 3. 4, 1. 2. 3. 4, 1. 2 }: print(b. b + sizeof b / sizeof b[0]. “b”. ” “): r = inner_product(a. a + ASZ. b, 0); cout « “inner_product 1: ” « r « endl: // С тем же результатом: г = inner_product(a. а + ASZ. b. 0. plus(). multiplies0): 322 Глава 6 • Обобщенные алгоритмы cout « “inner_product 2: ” « г « endl: int* it = partial_sum(a. a + ASZ. b): print(b. it. “partial_sum 1″. ” “): // С тем же результатом: it = partial_sum(a. a + ASZ. b. plus0); print(b. it. “partial_sum 2″. ” “); it = adjacent_difference(a. a + ASZ. b); print(b. it. “adjacent_difference 1″.” “): // С тем
Комментарии закрыты.
Последние комментарии