"D" isn't a char. 'D' is. Double quotes mean a char array (string), regardless of whether there is only 1 char in the array.
Hello I have this code
But I prefer to use chars for exampleCode:srand ( time(NULL) ); int bad1 = rand() % 9 + 1; int bad2 = rand() % 9 + 1; int bad3 = rand() % 9 + 1; int position = rand() % 9 + 1; int table1[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table2[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table3[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table4[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; table1[position] = position; table2[bad1] = bad1; table3[bad2] = bad2; table4[bad3] = bad3;
But that gives me an error.. any help to use char on a int array?Code:table1[position] = "D";
"D" isn't a char. 'D' is. Double quotes mean a char array (string), regardless of whether there is only 1 char in the array.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
So should be
or ? didnt understand some wordscause im not english.. can you explain?Code:table2[bad1] = 'D';
Using that code just gives me all numbers and the letter 'D' becomes a big number ex : 68 ...Code:srand ( time(NULL) ); char *num; int bad1 = rand() % 10; int bad2 = rand() % 9 + 1; int bad3 = rand() % 9 + 1; int position = rand() % 9 + 1; int table1[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table2[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table3[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table4[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; table1[position] = position; table2[bad1] = 'D'; table3[bad2] = bad2; table4[bad3] = bad3;
How I convert it to letter?
Continue getting number.Code:srand ( time(NULL) ); char num = 'D'; int bad1 = rand() % 10; int bad2 = rand() % 9 + 1; int bad3 = rand() % 9 + 1; int position = rand() % 9 + 1; int table1[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table2[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table3[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table4[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; table1[position] = position; table2[bad1] = num; table3[bad2] = bad2; table4[bad3] = bad3;
Continue getting number.Code:srand ( time(NULL) ); char num = 'D'; int bad1 = rand() % 10; int bad2 = rand() % 9 + 1; int bad3 = rand() % 9 + 1; int position = rand() % 9 + 1; int table1[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table2[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table3[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int table4[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; table1[position] = position; table2[bad1] = num; table3[bad2] = bad2; table4[bad3] = bad3;
Last edited by alvaritos; 09-08-2011 at 01:24 PM.
because of
table2[bad1] = num;
table2 is an array of ints..
You should read the basics. .___.
Variables. Data Types. - C++ Documentation
And that code seems really messy...
Last edited by 'Bruno; 09-08-2011 at 01:55 PM.
Light travels faster than sound. That's why most people seem bright until you hear them speak.
Make your arrays char arrays then, or typecast the elements.
Ok, solved thanks