Search found 4 matches
- Sun Oct 02, 2011 4:29 pm
- Forum: Programming Discussion
- Topic: Code Cracker Problems
- Replies: 9
- Views: 2515
Re: Code Cracker Problems
If you actually look at what the code is outputting, it's just doing 0,1,2... up to 99 followed by \300_\377, then 000 to 999 followed by _\377, then 0000 to 9999 followed by \377, then just normal numbers. the change in the numbers isn't entirely sequential, but that's the basic pattern; this mean...
- Sun Oct 02, 2011 3:33 pm
- Forum: Programming Discussion
- Topic: Code Cracker Problems
- Replies: 9
- Views: 2515
Re: Code Cracker Problems
You're initializing the entire c[] to -1, and then using that to index into the codex[] array. I'm surprised it didn't crash, but random garbage output should give you the hint that you're out of bounds on some array. Change the initialization to 0, it should fix that. By the way, the debugger is t...
- Sun Oct 02, 2011 2:56 pm
- Forum: Programming Discussion
- Topic: Code Cracker Problems
- Replies: 9
- Views: 2515
Re: Code Cracker Problems
strcmp returns 0 on success, which would be a logical 'false': http://www.cplusplus.com/reference/clibrary/cstring/strcmp/ . Right now your algorithm exits immediately because your 'if' check will pass when the strings are *not* identical. Add an ! in your if and it should work, unless i missed som...
- Sun Oct 02, 2011 8:42 am
- Forum: Programming Discussion
- Topic: Code Cracker Problems
- Replies: 9
- Views: 2515
Code Cracker Problems
Hello ladies and gentlemen. For the past few days I have been developing a C program that can crack codes. Here's the code: #include <stdio.h> #include <string.h> #define AMOUNT 10 //63 #define MAX 50 int main(int argc,char *argv[]){ int cracked=0; //boolean to control whether the program has cracke...