Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

getting a random letter in c++

    char c;
    int r;

    srand (time(NULL));    // initialize the random number generator
    for (i=0; i<num; i++)
    {    r = rand() % 26;   // generate a random number
          c = 'a' + r;            // Convert to a character from a-z
          cout << c;
    }
Source by www.cplusplus.com #
 
PREVIOUS NEXT
Tagged: #random #letter
ADD COMMENT
Topic
Name
4+2 =