Answers for "getting a random letter in c++"

C++
3

c++ generate random char

char cch = 'a' + rand()%26;
Posted by: Guest on March-08-2020
1

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;
    }
Posted by: Guest on June-24-2020

Code answers related to "getting a random letter in c++"

Browse Popular Code Answers by Language