Click here to Skip to main content
15,891,033 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: program runs and correct results, however, error messagr Pin
Mark Salsbery24-Sep-07 11:20
Mark Salsbery24-Sep-07 11:20 
GeneralRe: program runs and correct results, however, error messagr Pin
mrby12324-Sep-07 12:06
mrby12324-Sep-07 12:06 
GeneralRe: program runs and correct results, however, error messagr Pin
Mark Salsbery24-Sep-07 12:24
Mark Salsbery24-Sep-07 12:24 
GeneralRe: program runs and correct results, however, error messagr Pin
mrby12324-Sep-07 13:02
mrby12324-Sep-07 13:02 
QuestionRe: program runs and correct results, however, error messagr Pin
Mark Salsbery24-Sep-07 15:19
Mark Salsbery24-Sep-07 15:19 
AnswerRe: program runs and correct results, however, error messagr Pin
mrby12324-Sep-07 16:47
mrby12324-Sep-07 16:47 
GeneralRe: program runs and correct results, however, error messagr Pin
Mark Salsbery24-Sep-07 16:52
Mark Salsbery24-Sep-07 16:52 
Questionwhat kind of search is recommended??? Pin
pblais24-Sep-07 10:51
pblais24-Sep-07 10:51 
I have to do what, seems to me, is a binary search.

I have different hardware modules "out on the buss" each with its own unique 17 character ascii serial number. Initially, I don't know each's serial number and until I do, I can't communicate with them. I am going to scale down my example to 3 modules each with a 4 character wide alphanumeric (in real life each character can be any of the printable ascii characters)serial number.
Here would be the 3 units and their serial numbers..

Module # Serial #
1 ABG5
2 ABN4
3 BFT9

The way the hardware and software interface works is like this.

If I ask for any serial number starting with 'A', I will get a reply.. But I don't know how many yet.
If I ask for any serial number starting with 'B', the same holds true.
If I ask for any serial number starting with any other character other than 'A' or 'B', I don't get "a hit". Now, I can eliminate any serial numbers that don't start with the letters 'A' or 'B'

Now, I ask for serial numbers starting with 'AA' through 'AZ...A9' and get "hits" for 'AB' only.
I also run through any serial numbers starting with 'BA' through 'BZ...B9' and get one "hit" for 'BF'
This time, I eliminate anything that doesn't start with 'AB' or 'BF'

Each time I get "a hit" I don't know how many. Until I "drill" my way down through all four characters. At some point I will have only "one hit" for each of the serial numbers.

Nowwwwwwwwwwwwwwwwwwwwww.... How can I do this in Visual C++?????

As I mentioned above, I think this would be a binary search. But I am having a hard time figuring out how to "keep score" of the "non-hits" so that I don't waste time trying those on future iterations. Keeping in mind that each serial number is 17 characters wide and can be made up of any of the 95 printable ascii characters

Are there any code snippets that I can "stitch" together to do this....

Thank you in advance
Pierre





AnswerRe: what kind of search is recommended??? Pin
Waldermort24-Sep-07 19:16
Waldermort24-Sep-07 19:16 
GeneralRe: what kind of search is recommended??? Pin
pblais25-Sep-07 4:17
pblais25-Sep-07 4:17 
GeneralRe: what kind of search is recommended??? Pin
Waldermort25-Sep-07 4:40
Waldermort25-Sep-07 4:40 
GeneralRe: what kind of search is recommended??? Pin
pblais25-Sep-07 7:26
pblais25-Sep-07 7:26 
AnswerRe: what kind of search is recommended??? Pin
pblais3-Oct-07 8:50
pblais3-Oct-07 8:50 
QuestionSorry if wrong location. Trying to open unknown video type for processing. Pin
Code Monkey Mike24-Sep-07 10:41
Code Monkey Mike24-Sep-07 10:41 
QuestionCtrl Shift F9 will clear all breakpoints in VC 6.0 , however Pin
Vaclav_24-Sep-07 6:00
Vaclav_24-Sep-07 6:00 
AnswerRe: Ctrl Shift F9 will clear all breakpoints in VC 6.0 , however Pin
Maximilien24-Sep-07 7:21
Maximilien24-Sep-07 7:21 
QuestionCRectTracker static linking Pin
bob1697224-Sep-07 5:58
bob1697224-Sep-07 5:58 
AnswerRe: CRectTracker static linking Pin
Mark Salsbery24-Sep-07 6:36
Mark Salsbery24-Sep-07 6:36 
GeneralRe: CRectTracker static linking Pin
bob1697224-Sep-07 7:31
bob1697224-Sep-07 7:31 
Questiongraphics in c++ console program Pin
Sai Yasodharan24-Sep-07 5:58
Sai Yasodharan24-Sep-07 5:58 
AnswerRe: graphics in c++ console program Pin
bob1697224-Sep-07 6:06
bob1697224-Sep-07 6:06 
GeneralRe: graphics in c++ console program Pin
Matthew Faithfull24-Sep-07 6:14
Matthew Faithfull24-Sep-07 6:14 
AnswerRe: graphics in c++ console program Pin
El Corazon24-Sep-07 8:19
El Corazon24-Sep-07 8:19 
Questionread array of file names with CString array ? Pin
mrby12324-Sep-07 5:54
mrby12324-Sep-07 5:54 
AnswerRe: read array of file names with CString array ? Pin
Chris Losinger24-Sep-07 6:02
professionalChris Losinger24-Sep-07 6:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.