A Very Good Morning to you,
Hi and how do you do ?
I hope your day is going great.
I would like help writing a CPP Function() with the following criteria :-
It is to search for 4 digit numbers in a Pick 4 Game.
1. Given a 2D Array of 4 Digit Number from 0 to 9
Lets call this 2D array - Array 1
This Array consists of only 9 sets of 4 digit random numbers
Digits can be repeated up to 4 times
e.g. - 0000 or 0001 or 0012 or 0123 or 1234 or 2342 or 3422 or 5676 or 5644
2. Given a 2D Array of 4 Digit Numbers from 0 to 9
Lets call this 2d array - Array 2
This Array consists of say 1000 sets of 4 digit random numbers
Digits can be repeated up to 4 times
e.g. - 0000
0001
0012
0123
1234
3242
3453
6575
6786
8797
2342
3453
Questions -
-----------
Point A.
How can I search for all the 9 numbers from Array 1 in Array 2 with the following number criteria -
A. If all 4 digits in Array 1 are unique, find all combination of this 4 digits in Array 2
B. 1 digit from Array 1 can be an Exception - Meaning it can be a differnt number out of the 3 in Array 1
e.g. -
First Number in Array 1 to Search from Array 2 = 1234
Result of search in Array 2 will return - 1234 2134 4321 3214 2143 etc etc
Result of search from Array 2 will also include 4 digit numbers where 1 digit from Array 1 that can be
Different
look at this example - where 3 digits are found in Array 1 and 1 digit can be different out of the 4
digits found in Array 1
- e.g. 1238 2135 4372 3941 9421 4326 2149 2364 4351 1428 etc etc
Point B.
Now Array 1 can have duplicate random digits e.g. - 0000 1111 2222 3333 4444 0001 0012 0123 1234
For duplicate digits numbers in Array 1 - The Search for digits in Array 2 has the same criteria as Point A.
.e.g - Array 1 = 0012
- Search Returns - 2100 0012 0210 0120 1200 2100 2001 etc etc
- Search also returns Numbers where 1 number from Array 1 can be different in Array 2
e.g. - 2101 2102 2103 9012 8120 7210 8001 6002 2170 0127 0001 2210 1100 1208 0002 1100 1204 4002 2103 etc etc -
Can some kind soul please kindly write this CPP Function for me ???
Thank you very much for your time.
I hope you have a Great Day Ahead.
I am sorry - I am trying to Post some TEXT and the only way I can do so is to use the Code Formatting.
Sorry ...
TheTimeCat 0 Newbie Poster
tinstaafl 1,176 Posting Maven
tux4life commented: Excellent response! :) +13
TheTimeCat 0 Newbie Poster
TheTimeCat 0 Newbie Poster
tinstaafl 1,176 Posting Maven
ravenous 266 Posting Pro in Training
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.