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 !!

Recommended Answers

All 4 Replies

Can you show what you have already?
Some code please.....

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

Of course , good stuff. Thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.