12-10-01.cpp
来自「more efftive 代码」· C++ 代码 · 共 20 行
CPP
20 行
#include <iostream>#include <iterator>#include <functional>#include <numeric>using namespace std;int main(){ int A[] = {1, 2, 3, 4, 5}; const int N = sizeof(A) / sizeof(int); cout << "The sum of all elements in A is " << accumulate(A, A + N, 0) << endl; cout << "The product of all elements in A is " << accumulate(A, A + N, 1, multiplies<int>()) << endl;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?