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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#include <iostream>
#include <iomanip>
using namespace std;
const int MAX = 20;
void InitializeArray(int array1[MAX], int);
float InitializeArrayAsc(int array2[MAX], int);
void Print(int elements[MAX], int extent);
void Copy(int source[MAX], int target[MAX], int, int);
int main()
{
int array1[MAX];
int array2[MAX];
InitializeArray(array1, MAX);
InitializeArrayAsc(array2, MAX);
cout << "Array 1:\n";
Print(array1, MAX);
cout << "Array 2:\n";
Print(array2, MAX);
cout << "\nCopying Array 2 into Array 1...\n";
Copy(array2, array1, 0, MAX);
cout << "\nArray 1:\n";
Print(array1, MAX);
return 0;
}
void InitializeArray(int array1[MAX], int)
{
for (int i=0; i < MAX; i++)
{
array1[i] = 0;
}
}
float InitializeArrayAsc(int array2[MAX], int)
{
float arrayasc;
return arrayasc;
}
void Copy(int source[MAX], int target[MAX], int, int)
{
}
void Print(int elements[MAX], int extent)
{
const int PER_LINE = 10;
int i;
for(i = 0; i < extent; i++)
{
if (i % PER_LINE == 0 && i != 0)
{
cout << endl;
}
cout << setw(8) << left << elements[i];
}
cout << endl;
return;
}
|