something is wrong with this code.it prints 10 20 40 50 30.please help
#include “stdafx.h”
#include
#include
using namespace std;
int main()
{
int anarray[5] = {40,10,50,30,20};
for (int iii=0 ; iii <= 4 ; iii++)
{
static int n=anarray[iii];
static int count = 0;
for(int jjj=iii+1 ; jjj <=4 ; jjj++)
continue ;
else
{
n = anarray[jjj];
count = jjj ;
}
}
swap(anarray[iii],anarray[count]);
}
cout << "the ascending order is :" << endl;
for (int kkk=0 ; kkk <=4 ; kkk++)
cout << anarray[kkk] << " " ;
return 0;
}