Inversion of numbers

Pages: 12
How do I reverse decimal numbers?

ex : 2.369 => 963.2

Meanwhile without strings

Please help me!
Last edited on
closed account (Dy7SLyTq)
read it into a string, reverse the string, put it in a string stream, and stream into a float
please enter the code
but With no strings
Last edited on
closed account (Dy7SLyTq)
im not going to code it for you
why?
So just get guide how to get it without strings
please!
closed account (Dy7SLyTq)
ill write you some pseudo code
Which part is causing the problem?
1. read it into a string
2. reverse the string
3. put it in a string stream
4. stream into a float
Have you tried to do any of these steps for yourself?

Actually - it depends upon exactly what is your starting point - e.g. the decimal number comes from keyboard input, or from the result of a calculation etc. And similarly, do you need to do any calculations with the resulting value? As it stands the question isn't very precisely framed.
Last edited on
ok
tnks
closed account (Dy7SLyTq)
1
2
3
4
5
6
7
string Input
read Input
reverse(Input)
istringstream Out(Input)
double float_
Out >> float_
print float_


on an unrelated topic, that is my first attempt at pseudo code. how did i do?
chervil
tnks
but i want without string
closed account (Dy7SLyTq)
i dont think you can
@DTSCode:
i don't use pseudo code much, but this looks like a C++ program with compile errors ;)
please without strings
you can split the number into digits, and store them in an array of ints or doubles.
Last edited on
DTSCode
why?
closed account (Dy7SLyTq)
i cant think of a way with all of the algorithims i know to do it with out strings. not to say it cant be done, but i dont know how.
must be a way
What do you mean by "without strings"

Do you mean without std::string? Windows CString? C-style strings? Please try and be precise so we can help you.
Should be simple
wihtout string,class,...
closed account (Dy7SLyTq)
its not simple. why cant you use strings?
Pages: 12