1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#include <iostream>
using namespace std;
void showArray (int[], int);
void reverseArray(int[], int);
int main ()
{
const int SIZE = 10;
int values[SIZE] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
cout << "Original " << endl;
showArray(values, SIZE);
cout << endl;
cout << "Reversed " << endl;
reverseArray(values, SIZE);
return 0;
}
void showArray(int values[], int size)
{
for (int i = 0; i < size; i++)
{
cout << values[i] << endl;
}
}
void reverseArray (int values[], int size) // I know right here I will have to change to an int *
{
for (int i = (size - 1); i >= 0; i--)
{
cout << values[i] << endl;
}
}
|