# Convert Several int's to One.

Hey, Im pretty new to arduino and C++ so bear with me.

Im working on a small calculator project, most parts of it are working fine but im having trouble with inputing larger numbers.

Right now, the user types I(10 Numbers) [E.G I1111111111] into the serial monitor and sends, the first thing this does is trips and if statement that tells the program to run the function ManualInput() This then sets an int as 1 and runs the NumberI() function. This Decifers the Numbers after The Action Letter And sets them as Int's N1 Through N10, (When it gets to the bottom of NumberI an If statement sends it to ManualI2, due to the MI = 1;.

What i then wanted to happen was to convert the 10 N1-N10 int's into a single one called Answer. Which is eventualy Displayed.

I've searched low and high on the net but didnt come up with anything usefull / understandable.

Sorry if the question was badly worded.
Thanks in advance for any replies.

Alex.

Not sure if this helps explain it atall but this is what i want to happen.

Answer = N1, N2, N3, N4, N5, N6, N7, N8, N9, N10;

So if N1 was a 1, N2 A 2 ect i want Answer to be:

1234567891

(N10 being a 1)

Alex.

Reading the string "12345" from left to right, the characters are '1', '2', '3', '4', and '5'.

The numbers are the character minus '0'. '1' - '0' = 1. '3' - '0' = 3.

The number is, initially 0. Each time a digit is determined, the number is multiplied by 10 and the digit added.

0 * 10 + 1 = 1
1 * 10 + 2 = 12
12 * 10 + 3 = 123

You should be able to implement this in code fairly easily. If not, it's been discussed on the forum. Many times.

1234567891

Make sure you're using a datatype capable of holding a number this big.

Thanks for the replies =)

Gonna try out Paul's Method. Think it should be fairly easy to do.

Thanks again.
Alex

Success!
Thanks again =)

Alex.