how can i generate random letters?
i was thinking of using ascii, but i dont know how to do that either...
how can i generate random letters?
i was thinking of using ascii, but i dont know how to do that either...
rand() % 26 + 'A';
Well I am assuming that you want to have lower and upper case letters.
So here is my solution, don't know how well it will work:
#include <time.h>
#include <stdlib.h>
srand(time(0));
int num, let;
num = rand() % 2 + 1;
if (num == 1)
let = rand() %26 + 'A';
else
let = rand() %26 + 'a';
cout << let << endl;
That should work, I am not sure how efficient it is though.
Just try it.
tudehopet uses Borland Compiler 5.5
and Visual C++ 6.