Please send questions to
st10@humboldt.edu .
/*--------------------------------------------------
created by smtuttle at Thu Nov 18 15:09:29 PST 2010
--------------------------------------------------*/
#include <iostream>
#include <cmath>
using namespace std;
/*--------------------------------------------------
signature: get_nums : double[] int -> void
purpose: expects an array of numbers and its
size, and it
produces nothing, BUT it has the
following side-effects:
* it asks the user for
the same number of values as
the array's size, and
* it CHANGES the argument array
to contain those values
Examples: const int NUM_SCORES = 3;
double scores[NUM_SCORES];
for the call:
get_nums(scores, NUM_SCORES);
...the user will be prompted to enter 3
numbers; if he/she types
98
100
93.3
...when prompted, then after this call,
scores will contain {98, 100, 93.3}
pseudocode:
repeat size times
ask the user for a value
set the next value in values to that value
--------------------------------------------------*/
void get_nums(double values[], int size)
{
for (int i=0; i<size; i++)
{
cout << "enter the next value: ";
cin >> values[i];
}
}