# How can i split an int variable to 2 variables

for example:

int full_nr=45;

int temp_1; int temp_2;

i want temp_1 have '4' value and temp_2 to have '5' value

full_nr will have always 00-99 Value (2 digit) and never more than 100 (3 digit) so dont worry about it.

i want to split value of thermistor varaible

Divide it by integer ten, you should end up with "4"; that's one down. Multiply it by 10 (for 40), subtract it from "45" - to get "5" - there's the second.

Did we forget how to handle base-10 arithmetic? This was something taught in like 2nd grade, from what I recall (of course, they never presented it that way)...

mmm so an integer can't handle numbers after ",' (cant tell that in english sorry)

i didnt know that it is the same with visual basic.

anyway thanks alot

Integers are just that - no decimal points allowed (in the US we use a period for decimal points, I know that elsewhere commas are used).

I am not sure about current VB, but I know in VB6 variables are, by default, "variant" type - but can be re-typed by declarations to whatever type you want, including integers.

I also know that there are two divisor symbols in VB; forward slash is standard division, backslash is for integer division. You could also use modulo operators.

In C/C++, you just have the forward slash for division, and the type handling will automagically drop the decimal portion...see here:

http://arduino.cc/en/Reference/Arithmetic

Notice the part where it says "for example, 9 / 4 gives 2 since 9 and 4 are ints" - that's the answer (so no special backslash operator in C for integer division like in VB).

Note that the above, and what I told you about before, indicates that it is possible to operate on each portion of a floating point number using integer math - this is called "fixed point arithmetic"; I believe this is how the compiler currently handles decimals anyhow.[/edit]

I believe this is how the compiler currently handles decimals anyhow

IEEE754 isn't fixed point, or did you mean actually during compilation?

I know that elsewhere commas are used

The dot is the default decimal operator in coding enviroments, and I believe in english based enviroments in general. Officially, it is the comma for decimal here.. most people tend to use the dot though. For once the US appears to be using an international standard ::)