for(int j=0;j<5;j++)
{getch(); //just for tracking output
cout<<a[j]<<"\n";}
cout<<"wanna conntinue???\n"<<"Press Y to continue"<<"\n";
cin>>v;
}while(v=='y');
getch();
}
OUTPUT:
o/p:
ENTER 5 VALUES:
9
7
5
6
8
SORTED NUMBERS
============
1 // <-- From where this 1 came??
5
6
7
8
wanna conntinue???
Press Y to continue
y
ENTER 5 VALUES:
9
7
5
6
8
SORTED NUMBERS
============
5 // 1 is coming for the 1st time only.
6 //From 2nd itteration of do while, sorting is done properly.
7 // Pls. tell me wats wrong with this program..
8
9
wanna conntinue???
Press Y to continue
@ noobletplusplus:
Ya u r ryt....
May b coz c++ dnt deal with array bound check and also due to some garbage value at a[5], which was greater than my inputs..
I tried for some random inputs, its also showing some unexpected outputs...
on CODE BLOCK..