I am on the section in the tutorials about an indeterminate amount of function arguments. I have tried to change the example to allow user input and have ran into a problem with it. It is just a simple average calculator that is supposed to get user input for numbers to find the average of. It is probably an easy fix but i'm still learning and can't figure out what is wrong with the code. If i leave it as is there are no errors from the compiler. If I enter one number it returns the value "inf" if more than one the program crashes. Any help would be greatly appreciated.

Code:#include <cstdarg> #include <iostream> using namespace std; char numbers[150]; double average ( int num, ... ) { va_list numbers[2]; double sum = 0; va_start (numbers[2], num); for (int x=0;x<num;x++) sum += va_arg (numbers[2], double); va_end (numbers[2]); return sum / num; } int main() { cout<<"Please enter numbers to find the average): "<<endl; cin.getline ( numbers, 150); cout<<average (numbers[2])<<endl; }