0

Hi ,
In Visual Studio CLI. I have randomly generated numbers(zero to nine) which are a,r,g,b . One by one they are meaningless . Together they create a color code for different products. For example :

id   a r g b
i    1 1 5 9
i+1  6 0 2 1 
i+2  9 0 0 3 
.. ...

Aim is to save each 'a'r'g'b' row as a single number into integer array .
Seeking for a better solution at least 2 days..
Please help !!

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by smurfy
0

Hi richieking,
Here is the code :

for(r=1; r < 4 ; r++)
	for(g=1; g < 4; g++)
		for(b=1; b< 4; b++)		      
{								 
me_pe[i] = (100 * r) + (10 * g) + b  ;    // inputs 112
								 
ac_m[i] = me_pe[i] % 10 ;                // 2 ok
								 
oc_m[i] = (( me_pe[i]-b ) / 10 ) % 10 ;   // 1 ok
								 
k_m[i] =  ( (me_pe[i]- (g*10) - b ) / 100 )  ;  //1 ok  

}

It would be better a better if i have another solution,idea for the issue.
Please help

Edited by smurfy: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.