I am new to c++, I have found some tasks to do, but there is a problem. My task is to compare 2 intigers, and try to find out if they an be changed so one of them is bigger than other, for example:
input: 35 and 45 can be changed to 53 and 45.
I am trying to get 2 numbers and to put them in arrays to sort them, but I dont know how to do char to array and back, can you give me an example or link to the code please so I can change the values in array (for example if I get 10 then I want to change 0 to something)? All the comparing I know how to do.
Ah, I assumed the numbers always were supposed to have two digits.
You shouldn't use char arrays when not necessary, use std::string instead.
You can use std::sort to sort your digits as follows: