list9-5.cpp
来自「这是关于VC++中的STL容器的资料,包括了STL容器各个类之间关系以及类的说明」· C++ 代码 · 共 27 行
CPP
27 行
// List 9-5
// Demonstrates Use of accumulate with List of Integers
#include <numeric>
#include <list>
#include <iostream>
using namespace std;
void main(void)
{
list<double> Integers;
int Count;
int N;
int X;
cout << "How Many Numbers ";
cin >> Count;
for(N = 1;N <= Count;N++)
{
cin >> X;
Integers.push_back(X);
}
cout << accumulate(Integers.begin(),Integers.end(),0);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?