Hi
I coded a program where you can reverse the contents of an array. But I used two arrays to complete this process, I want to make it work by using only one array.
Here is my code so far, it works btw, just need to make it work by using only one array:
#include<iostream>
using namespace std;
int main()
{
int a[10], b[10],i,j;
cout << "Enter 10 values for array: ";
for(i=0;i<10;i++)
{
cin >> a[i];
}
for(i=0,j=9;i<10;i++,j--)
{
b[j] = a[i];
}
cout << "\n\nOrginial Array is: ";
for(i=0;i<10;i++)
{
cout << a[i] << ", ";
}
cout << "\n\nNew Array is: ";
for(i=0;i<10;i++)
{
cout << b[i] << ", " ;
}
return 0;
}