A for() loop in a for() loop
Can be closed, I'm an idiot

Brackets aren't needed here, i just don't understand how these for loops work.
I'm pretty damn sure you need brackets... and even if you don't you should add them anyway, it makes it easier for people to read your code.
But anyway I see your problem. Your making j = i +1. You should make j=0. That was say the second for loop will be able to look through the entire array to find a match for element [i].
Hmm never mind... I just didn't understand how the second for loop would work inside the first and why j was set to i+1, but i understand now after trying those cout statements from laka
Ok...if you want me to... and thanks lalakiljip.