mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-17 04:34:40 +03:00
8 lines
193 B
C++
8 lines
193 B
C++
#include <iostream>
|
|
template<typename ... T>
|
|
auto average(T ... t) {
|
|
return (t + ... ) / sizeof...(t);
|
|
}
|
|
int main() {
|
|
std::cout << average(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) << std::endl;
|
|
} |