Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random letters

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hallo,

Can you help me,
I want to generate random letters (not numbers!) under Visual C++. Do you know a command?

Best
regards

Marco Berg
 
I don't remember how to do this but you could use this method:
Randomize the correct numbers (all the letters ASCII values) and then convert that back to a letter.
 
#include <time.h>
#include <stdlib.h>

...
srand(time(NULL));
char c;

c = rand()%26 + 65;
...

this will give you a random capital letter.
Best Regards,

aphrodita@mail.krovatka.ru {uiuc rules}
 
rand()%('z'-' ')+' ';/*' ' means a space John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top