Showing posts with label array mirror image. Show all posts
Showing posts with label array mirror image. Show all posts

Tuesday, 15 March 2016

Program To Print The Mirror Image of an Array in C++

"Nice One Program"

#include<iostream.h>
#include<conio.h>

void main()
{  clrscr();
  int a[7][7];  int r,col;
  cout<<"Enter The number Of Rows and Columns:";
  cin>>r;
  cout<<endl;
  cin>>col;

  cout<<"\n\n";
  cout<<"Enter The Elements Row wise\n";

  int i,j;

  for(i=0;i<r;i++)
  for(j=0;j<col;j++)     //Array Input
  cin>>a[i][j];

cout<<"\n\n";

  for(i=0;i<r;i++)
{ cout<<endl;
  for(j=0;j<col;j++)
  cout<<a[i][j]<<" "; //Printing Original

  cout<<"-->";

  for(j=col-1;j>=0;j--) //Printing Mirror Img
  cout<<a[i][j]<<" ";

}
getch();

}