+ 1
Can you output random letters using <ctime>&<cstdlib>
2 Respostas
+ 9
You can. But first, you need to find out the range of ASCII values of the letters you want to be randomly printed.
srand(time(0));
for(int i = 0; i < 5 ; i++)
{
int x = rand() % value_range;
cout << static_cast<char>(x);
}
// outputs 5 random chars within a ASCII value range
+ 3
Try it and find out. That's the best way to learn.