Biggest possible number from given blocks of digits C++
For given number of blocks of digits (nhumber of blocks is bigger than 2, smaller than 1000), print the biggest possible number.

Here's a little example:

input:

5 // Number of blocks of digits

9 // first block

98 // second

90 // third

5 // fourth

9 // fifth

output:

9998905 // The biggest possible number

I work a little bit on this problem and i have found the algorithm and it seems like it's working for any combination, but i'm having problem with writing a code in C++

Here's the algorithm:

First i input them as a strings, because i can muc easier use specific digits.
Then i'm comparing every number's first digit with the every number's first digit. And order them in ascending order.
If the first digits are same, i'm checking the second digits and so on to the last digits.
If in case the two number have different lengths and the smaller is substring to the other, i order the smaller in front of the bigger number.

As i said before, this algorithm work fine, but i need the code, because i'm having problem with it.
Biggest possible number from given blocks of digits C++
===

For given number of blocks of digits (nhumber of blocks is bigger than 2, smaller than 1000), print the biggest possible number.

Here's a little example:

input:

5 // Number of blocks of digits

9 // first block

98 // second

90 // third

5 // fourth

9 // fifth

output:

9998905 // The biggest possible number

I work a little bit on this problem and i have found the algorithm and it seems like it's working for any combination, but i'm having problem with writing a code in C++

Here's the algorithm:

First i input them as a strings, because i can muc easier use specific digits.
Then i'm comparing every number's first digit with the every number's first digit. And order them in ascending order.
If the first digits are same, i'm checking the second digits and so on to the last digits.
If in case the two number have different lengths and the smaller is substring to the other, i order the smaller in front of the bigger number.

As i said before, this algorithm work fine, but i need the code, because i'm having problem with it.