Monday, September 19, 2016

Reverse An Array

Tags

//program to print array elements in reverse
#include<iostream>
using namespace std;
main()
{
int a[10],b[10];
cout<<"ENTER ELEMENTS";
for(int i=0;i<10;i++)
cin>>a[i];
int i=9;
int j=0;
 while(j<10&&i>=0)
 {
  b[j]=a[i];
     i--;
     j++;
 }
 for(i=0;i<10;i++)
 {
  cout<<b[i]<<"\t";
 }
}




Also see program of operator overloading CLICK HERE