-1

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.J.
  • 15,637
  • 9
  • 61
  • 77
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.J.
  • 15,637
  • 9
  • 61
  • 77
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
  • 25,014
  • 6
  • 48
  • 78