save many variables in on variable

December 18, 2011 at 02:38:00
Specs: Windows 7
okay i will be thankful if you help me in this problem ...after i put the random numbers in a variables now i wanna put all the variables as i said before in a one variable for example if we have 3 variables b1 b2 & b3 and the computer choose for b1 a zero value , for b2 a one value and for b3 a zero value how i can make them 1 number and save them to the memory i will put an example to be more helpful to you :
b1 =0 b2 =1 b3 =0 and we have int number=0 ; //initially initialized//
okay no i wanna put number = b1b2b3 => number = 010 ;
because i need this number to called from another method created by the programmer(me)
thank you very much


See More: save many variables in on variable

Report •


#1
December 18, 2011 at 08:19:17
perhaps

set a/ number1 = b1+b2+b3

this will do the sum? if thats what you want?

mike


Report •

#2
December 18, 2011 at 10:36:56
I think he wants the numbers to be put together and not added
So its like
SET b1=0
SET b2=1
SET b3=0
SET number=%b1%%b2%%b3%

Echo %number%

That will show as;
010

Hope that helps.


Report •

#3
December 18, 2011 at 18:26:40
If the numbers may have different number of digit there is no way of separating them.

Report •

Related Solutions

#4
December 20, 2011 at 05:51:24
oh, that makes a lot of sense Loq. I didn't think on it that way.

mike


Report •


Ask Question