Honor Code Acknowledgment: _____________________________
Due: Monday, June 14, 1999 9 points
Write a function named SumUpEven that given an integer vector and the number of elements in the vector, returns the sum of the even integers in the array.
For example, consider the vector called scores:
SumUpEven(scores,7) returns 22 (the sum of the even numbers 8 + 4 + 10).
The header for SumUpEven is below.
int SumUpEven (const Vector <int> & scores, int number)
// precondition: number is the number of integers in the array scores,
// stored in locations 0, 1, 2, ... , number-1
// postcondition: returns the sum of the even integers in the Vector
//
{
Write a function named DoubleUp that given a vector of strings, doubles the size of the Vector, creating a second copy of each item, immediately to the right of it.
For example, consider the vector called fruit:
DoubleUp(fruit,3) modifies the vector fruit to look like:
The header for DoubleUp is below.
void DoubleUp (Vector <string> & fruit, int & number)
// precondition: number is the number of strings in the array fruit
// postcondition: modifies the array fruit to have two copies of each
// original item (adjacent to each other),
// the "number" of items is doubled
{