#include<bits/stdc++.h>
using namespace std;
//count用于表明后续需要读入多少个参数
void sum(int count,...)
{
va_list v;
va_start(v, count);
int ans = 0;
cout << "参数个数为:" << count << endl;
for(int i=0;i<count;i++)
{
int value = va_arg(v, int);
cout << value << " ";
ans += value;
}
cout << endl;
va_end(v);
cout << "和为:" << ans << endl;
}
int main()
{
sum(5, 1, 2, 3, 4, 5);
}