I have a 3x3 array of text fields whose values get transferred to an int array. I need to make sure that integers 1-9 each occur once within the int array. Any ideas on how to go about that? I could do it by verifying that every int is between 1 and 9 and then adding them up to see if the total is 45. There are two problems with that: First, eventually I'm going to add code to highlight the first invalid number found (whether it be a duplicate or an int other than 1-9) so I'll need to know which number is invalid. Second, I know there's got to be a much easier way than that. Any ideas? Thanks in advance!
SMITA6076
0
Light Poster
Recommended Answers
Jump to PostI guess you could have an array that holds 1-9. and, each time a number is typed in your text fields, as long as it is between 1 and 9, inclusive, you set the corresponding value in the initial array I suggested to 0. Every time a user types in …
Jump to PostOr the array could be boolean vs int and set it true if the number has been used.
All 5 Replies
bibiki
18
Posting Whiz
NormR1
563
Posting Sage
Team Colleague
bibiki
18
Posting Whiz
NormR1
563
Posting Sage
Team Colleague
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
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.