Image rotation code probelm


it is giving incorrect output. pls help

Hello,
The logic you have applied for the mirror part is correct.
But, it seems like if you have got confused between i and j.

I have done the following modification in your code, kindly go through that.

for(j=0;j<row;j++){
for(i=0;i<col;i++){
if(i<col/2){
int k=a[j][i];
a[j][i]=a[j][col-i-1];
a[j][col-i-1]=k;
}
cout<<a[j][i]<<" ";
}
cout<<endl;
}

Hope, this would help.
Give a like, if your are satisfied.