how to make a name from random numbers?

Posted by blood on Stack Overflow See other posts from Stack Overflow or by blood
Published on 2010-04-28T01:58:50Z Indexed on 2010/04/28 2:03 UTC
Read the original article Hit count: 350

Filed under:
|

my program makes a random name that could have a-z this code makes a 16 char name but :( my code wont make the name and idk why :( can anyone show me what's wrong with this?

char name[16];
void make_random_name()
{

  byte loop = -1;

  for(;;)
  {
      loop++;

      srand((unsigned)time(0));
      int random_integer;

      random_integer = (rand()%10)+1;

      switch(random_integer)
      {
      case '1': name[loop] = 'A';
          break;
      case '2': name[loop] = 'B';
          break;
      case '3': name[loop] = 'C';
          break;
      case '4': name[loop] = 'D';
          break;
      case '5': name[loop] = 'E';
          break;
      case '6': name[loop] = 'F';
          break;
      case '7': name[loop] = 'G';
          break;
      case '8': name[loop] = 'Z';
          break;
      case '9': name[loop] = 'H';
          break;
      }

      cout << name << "\n";

      if(loop > 15)
      {
          break;
      }

  }


 }

© Stack Overflow or respective owner

Related posts about c++

Related posts about random-generator