Discussion Locked

Alphanumeric ID Code

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello, I am learning C++.

I'm trying to determine how to to create a 7 digit I.D. code by accepting user input. The I.D. code needs to accept both digits and letters (e.g. C456W91). I understand how to create either an array of integers, OR anarray of characters but I am unsure how to go about combining integers and characters in this way.

Thanks for any help you might offer.

1 reply

by jay eckles

Here's a hint:
4 is an integer.
'4' is a character.

C456W91 should be stored as a character array. You can always convert a character to an integer later if you need to.

An alternative would be to store an array of pointers to unions. The unions will have two members, one a character and the other an integer.

This discussion is closed to new replies.