0

I am to create a c++ logic game with with the difficulty of 3-10 characters (@#%?) that are produced within a string randomly. The player is to guess the random characters. Once the player has guessed, the message of how many the player guessed right is displayed. I am using the switch command to have the player determine the difficulty level, I am not sure how to create a random string with gen_random.

C Johnson
  • 15,085
  • 9
  • 58
  • 75
dwayne
  • 1

2 Answers2

0

This was answered here on stack overflow:

How do I create a random alpha-numeric string in C++?

This guys solution generates a random string of characters (i.e. char*) of a specified length.

Community
  • 1
  • 1
C Johnson
  • 15,085
  • 9
  • 58
  • 75
0

This sounds like homework. But remember that a character is just a number you can get a random number using rand. So char x = 'a' + aRandomNumber()

rerun
  • 24,358
  • 6
  • 47
  • 75