|
-
Jan 7th, 2003, 08:50 AM
#1
Thread Starter
Junior Member
Reversing an array
I need to find out how to reverse an array.. here is the code
// REVERSE.CPP
//
// This program reverses the order of the elements in an array.
//
// Author: Leon Noel
#include <iostream.h>
#include "apvector.h"
void Reverse(apvector<int> &a);
int main()
{
apvector<int> test(6);
int i;
// Set the test values in the array:
test[0] = 1;
test[1] = 1;
test[2] = 2;
test[3] = 3;
test[4] = 5;
test[5] = 8;
// reverse the array:
Reverse(test);
// Display the array:
for (i = 0; i < 6; i++)
cout << test[i] << ' ';
cout << endl;
return 0;
}
void Reverse(apvector<int> &a)
// Reverses the elements of the array
{
int i, ...;
while {...}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|