Please send questions to
st10@humboldt.edu .
#include <iostream>
#include "sumArray.h"
using namespace std;
/***************************************************
Contract: main : void -> int
Purpose: playing with simple arrays, part 1
Examples: not really applicable
CS 131 - Lecture 9-2 - 10-22-03
By: Sharon M. Tuttle
last modified: 10-23-03 (this opening comment block! 8-) )
**************************************************/
int main()
{
// local variables
int desiredSize;
// what size of a number set is desired?
cout << "How many numbers shall be in the set? ";
cin >> desiredSize;
// now declare array of numbers of that size
double numSet[desiredSize];
// now, FILL it...
for (int i=0; i < desiredSize; i++)
{
numSet[i] = i/2.0;
}
// now, VIEW it...
for (int i=0; i < desiredSize; i++)
{
cout << "numSet[" << i << "]: " << numSet[i]
<< endl;
}
cout << "...and the sum of its elements is: "
<< sumArray(numSet, desiredSize) << endl;
return 0;
}