1. ## c++ code

Hi can some one tell me what's wrong here its not showing the results that should be
Code:
```for(int s=0; s<n; s++){		 		cout<< "for the custmor " << s << "his neighbors in the increasing distance order are : " << endl;
for(int b=1; b<n;b++){
for (int w=0; w<n; w++)
if(s!=w)
for (int i=1; i<=b ;i++){
if(vect[s][i]!=w){
for(int m=w+1;m<n; m++)
if(s!=m){
for (int i=1; i<=b ;i++){
if (vect[s][i]!=m){
if(dis[s][w]<dis[s][m]){
if(dis[s][w]<distance){
voi=w;
distance=dis[s][w]; }}
else if(dis[s][w]>dis[s][m]){
if(dis[s][m]<distance){
voi=m;
distance=dis[s][m]; }}}}
vect[s][b]=voi;}}}
cout << vect[s][b] <<endl;}}```

2. What does this do and what's wrong with the results?

3. it display for each custmor his neighbors in the increasing order of distance , for example here the distance between the custmor 0 and 1 is 6.32 and the distance between 0 and 2 is 3.6 , so te neighbors of the custmor 0 in the increasing order of distance are 2 then 1
but you see here it always show that the neighbors are 2 for all the custmors what should i do ? plz some one give me an idea

4. I give you one suggestion learn how to indent your code!

Tim S.

5. It is unusual to have 11 levels of nested control structures, including 6 nested loops. Whenever your code gets that complicated you should consider that you might be overcomplicating things.

Code:
```for each row in the distance matrix:
copy the distances and indices to a temp array
sort the temp array by the distances
print the saved indices of the temp array in order
(except where the index equals the current row index
or, equivalently, except where the distance is 0)```
Even if you write your own sort, this shouldn't take more than 3 levels of loops. If you use std::sort it will take just 2 levels.

6. Too much nesting!!!