Changing order of digits

Hello. I have to change order of digits. For example, in text file (*.txt for example) there are "799 938", and in the end I have to get result "997 839" in results text file. Any ideas how to do this?
Just to make sure I've understood everything:
There are a few numbers in a text file, separated by whitespaces. Every single number should be reversed. Is that true? Are there numbers in the file separated through line breaks?
Last edited on
Read in each set as string, not as an int.

Reverse the string.

Write it to the output file.
No. Read as an int. These kinds of HW exercises are designed to teach about basic mathematical operations on unsigned values.

Hint: you don't actually have to reverse the unsigned value to another unsigned value. You just have to be able to take it apart and print the pieces to the display in the correct order.
Forgot to mention that numbers have to be int. Duthomhas, thank you, I finally managed to solve this one. Tried to do the same with string, didn't worked, but it's probably just because I failed somewhere. Anyways, thanks.
Topic archived. No new replies allowed.