Hi, I'm rather new at C++, and I'm having problems wrapping my brain around this problem. What I'm supposed to do is as follows:
Write a function that takes an arbitrary integer value and returns the number with its digits reversed. For example, given the number 12345 the function should return 54321. We assume that the reverse of 1000 can be 1 because leading zeros are omitted. Similarly, the reverse of 000123 is 321.
We're learning about arrays in my class right now, so I'm assuming that the code has to do with fitting each digit into its own array component. I'm pretty sure I know how I could reverse each digit were placed in its own component in array, but my problem has to do with putting each digit into it's own component. Any ideas as to how I could go about doing that? Thanks so much!
Write a function that takes an arbitrary integer value and returns the number with its digits reversed. For example, given the number 12345 the function should return 54321. We assume that the reverse of 1000 can be 1 because leading zeros are omitted. Similarly, the reverse of 000123 is 321.
We're learning about arrays in my class right now, so I'm assuming that the code has to do with fitting each digit into its own array component. I'm pretty sure I know how I could reverse each digit were placed in its own component in array, but my problem has to do with putting each digit into it's own component. Any ideas as to how I could go about doing that? Thanks so much!
Comment