Me and my friend need to make a license plate generator program as a final project for our c++ class. We're trying to make it so it outputs 6 random numbers and letters. I'm gonna try to make it pick 6 random numbers between 0 and 35. If it is a number between 0 and 9, it will show up as that number and if it is between 10 and 35, it will show up as a letter (10=A, 11=B, 35=Z). We can make it generate a number between 0 and 35, but don't know how to make it assign letters to the numbers it generates. So could anybody tell me how you would do that?

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main ( void )
{
   static const char value[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   int i;
   srand ( time ( 0 ) );
   for ( i = 0; i < 6; ++i )
   {
      putchar ( value [ rand() % ( sizeof value - 1 ) ] );
   }
   putchar ( '\n' );
   return 0;
}

And of course make sure you keep track of the numbers already generated so you don't end up handing out the same one twice...

I'd also be very careful turning in the solution shown above as it's not C++ at all (though a decent idea to get you started on your own work).

Remember people, we're not here to do peoples' homework for them, only to help with specific technical details...

ok thanks for the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.