diff options
Diffstat (limited to '6p27.cpp')
-rw-r--r-- | 6p27.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/6p27.cpp b/6p27.cpp new file mode 100644 index 0000000..2cc6f99 --- /dev/null +++ b/6p27.cpp @@ -0,0 +1,25 @@ +#include <iostream> + +/* + * + * 6.27 + * + * + */ + +void initlisttest(std::initializer_list<int> list) { + + int sum = 0; + for(auto a : list) { + sum += a; + } + std::cout << sum << std::endl; +} + +int main () { + + initlisttest({10, 10, 10, 10, 10, 10}); + initlisttest({10, 1}); + initlisttest({2, 2, 2}); + return 0; +} |