Random Letters

Is it possible to have c++ make a random letter? or is there a way possibly to modify,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
switch (c)
     {
        case '1' : maxrand = 15;  // the random number will be between 0 and maxrand
        break;
        case '2' : maxrand = 30;
        break;
        case '3' : maxrand = 50;
        break;
        default : exit(0);
        break;
     }

     life = 5;         // number of lifes of the player
     srand( (unsigned)time( NULL ) ); // init Rand() function
     j = rand() % maxrand;  // j get a random value between 0 and maxrand

     GetResults();
to make a random letter?
cout<<(char)rand()%RANGE+START

You can use getch() from conio.h to find the integer value of normal letters.
I need something that will just give me a letter, lets say a-e or z-w or what ever I choose, I just dont know how to do it
(lower case) letters start from character 'a' (ASCII 97) so you would have to add that to the random value
Topic archived. No new replies allowed.