Is there any way to shorten this?

Playing a game, I got stuck on a mini gamne puzzle in which You were required to find numbers, then put them into a five digit code to open a door. I had found the numbers but had no idea what order they should go in. So i made a a C++ code to give me all the possible numerical sequences. This was the end result.