Hi, im wondering how to make randomly type letters.
Like this for a example
----------------------------------------------------------------------
int A;
A = 1;
while (A == 1) {
cout
srand ( time(NULL) );
printf ("Random number: %d\n", rand() % 100);
srand ( 1 );
}
----------------------------------------------------------------------
But that is a random number generator up to 100. But how do i make it throgh A-Z or even words?
so now you can mod 26 which will give you the range of indices in the above array: so from 0 - 25 siince whatever number mod divisor is b/t: 0 to (divisor - 1).
I'm assuming you want to different colours usiing hexidecimal coloring scheme
which is 0x(A-F)(0-9).
// If you know how to use the "For" loop:
for(char i = 'A'; i <= 'Z'; i++)
{
printf("%c, ", i);
}
// If you don't know how to use the "For" loop:
char i = 'A';
while(i <= 'Z')
{
printf("%c, ", i);
i++;
}
Will print each character like:
A, B, C, D, E, (...)
Also try to call srand just once, in the beginning of your program like: