بسم الله الرحمن الرحيم
اخواني المبرمجين اطلب منكم طلب واتمنى ان لاتردوني
اريدكم ان تشرحونه فقط وانا جلبته من موقع اجنبي
#include<iostream>
using namespace std;
int*ReverseArray(int*orig,unsigned short int b)
{
unsigned short int a=0;
int swap;
for(a;a<--b;a++) //increment a and decrement b until they meet eachother
{
swap=orig[a]; //put what's in a into swap space
orig[a]=orig; //put what's in b into a
orig=swap; //put what's in the swap (a) into b
}
return orig; //return the new (reversed) string (a pointer to it)
}
// the following is a test program
int main()
{
const unsigned short int SIZE=10;
int ARRAY[SIZE]={1,2,3,4,5,6,7,8,9,10};
int*arr=ARRAY;
for(int i=0;i<SIZE;i++)
{
cout<<arr<<' ';
}
cout<<endl;
arr=ReverseArray(arr,SIZE);
for(int i=0;i<SIZE;i++)
{
cout<<arr<<'';
}
cout<<endl;
cin.get();
return 0;
}