Okay, so I'm a bith confused on how to do this.
My program syntax is as follows.
User enters a string
String is validated for correct characters
After each character is validated, minus 1 from that characters count
The last part is what I'm not sure how to do.
I need that if the user enters A, and A has a starting value of 18, then after each A, int A--. Now I realize that I could use a switch statement for this, but I'm dealing with 48 characters. That's a lot of statments.
So how can I do it so that when the user enters A, the computer knows to take away 1 from int A's value?
I was thinking this might be able to be done with an enum, but I don't know how if it is possilbe.
Please also note that several of the values will start with the same number, so I'll be wantiing to use this method: a=b=c=d=18;
int counts[ 48 ];
// Use for loop() to initialize all to 18 (or whatever)
// counts[ 0 ] is for 'A'
// counts[ 1 ] is for 'B'
// etc.
// when you read a character, you have to compute its index.
// for example, ch - 'A' == 0 if ch == 'A', 1 if ch == 'B', etc.
I though about doing that, but the ASCII values are scattered, thus, I need to know how to convert A to 0 and , to 31 and " to 35. I'm thorwing out random values there, but still.
It seems like I'd have to do a multi-dimensional array, one side having the ASCII, the other having the value. Which as you know, ends up being a lot of code!