Hi
i wanted to know how to convert an array of ints to a single int, for example:
how can i do that?? help plsCode://I want to convert this: int a[20]={4,2,4,5,6,1,2}; //to this: int c=4245612;
Hi
i wanted to know how to convert an array of ints to a single int, for example:
how can i do that?? help plsCode://I want to convert this: int a[20]={4,2,4,5,6,1,2}; //to this: int c=4245612;
Did you forget how the decimal system works?
Each place is a power of 10, simply multiply each element by 10 to its respective place. So,
Or put all the numbers in a string, and parse it out.Code:{4,2,4,5,6,1,2} = (10^6 * 4) + (10^5 * 2) + (10^4 * 4) + (10^3 * 5) + (10^2 * 6) + (10^1 * 1) + (10^0 * 2)
Tks man solved