+ 1

How to invert a decimal number with function in c++?

For example:12,345 ---> 543,21

7th Jun 2021, 5:57 AM
Maryam
Maryam - avatar
12 Antworten
+ 2
By converting it to a string
7th Jun 2021, 6:34 AM
Atul [Inactive]
+ 1
Martin Taylor I think so it is quite tricky to reverse a number using loops only. Isn't it?
7th Jun 2021, 9:24 AM
Atul [Inactive]
+ 1
Atul because i don't want to use string And no other way came to my mind
7th Jun 2021, 11:54 AM
Maryam
Maryam - avatar
+ 1
Atul ok thanks
7th Jun 2021, 12:03 PM
Maryam
Maryam - avatar
+ 1
implementation of reversed float (using double for better precision), without string: https://code.sololearn.com/cxNZV8vEmt28/?ref=app
9th Jun 2021, 11:18 AM
visph
visph - avatar
0
Nazanin Is this your attempt for the above question ❓
7th Jun 2021, 11:26 AM
Atul [Inactive]
0
I am not able to understand why you used too many loops?
7th Jun 2021, 11:26 AM
Atul [Inactive]
0
If you don't want to use strings then try to make your number as a whole number
7th Jun 2021, 12:01 PM
Atul [Inactive]
0
I don't really know why these questions are asked at the university. A programmer will never use such this function.
7th Jun 2021, 12:44 PM
Mehran
Mehran - avatar