Click here to Skip to main content
15,926,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDeleting a File thru .EXE Pin
002comp2-Sep-09 19:00
002comp2-Sep-09 19:00 
AnswerRe: Deleting a File thru .EXE Pin
002comp2-Sep-09 19:30
002comp2-Sep-09 19:30 
AnswerRe: Deleting a File thru .EXE Pin
David Crow3-Sep-09 2:45
David Crow3-Sep-09 2:45 
AnswerRe: Deleting a File thru .EXE Pin
Hamid_RT3-Sep-09 3:37
Hamid_RT3-Sep-09 3:37 
QuestionExclude From Theming Pin
Kyudos2-Sep-09 14:50
Kyudos2-Sep-09 14:50 
AnswerRe: Exclude From Theming Pin
Joe Woodbury2-Sep-09 16:57
professionalJoe Woodbury2-Sep-09 16:57 
AnswerRe: Exclude From Theming Pin
Randor 16-Sep-09 2:17
professional Randor 16-Sep-09 2:17 
QuestionScramble game search help Pin
vtsmokey882-Sep-09 14:31
vtsmokey882-Sep-09 14:31 
The project involves the game scramble, where we have a 4x4 matrix of characters. The purpose of the program is to search through the matrix and find words in the matrix. I have a dictionary .txt file and can search that for a word correctly and can also print the 4x4 matrix. The problem lies on how to actually search the matrix for a word. The letters can be combined to form a word by any "touching" letters.

For example:
D O P C
H L A R
E S M T
B D E I

One of the words would be car.

So, basically, I need help with how you would go through the matrix and how you would be able to move to any letter touching.

int main(){
    
    FILE* Lex = fopen("lex.txt", "r");

    int i = 0;
    int j = 0;
    char *word = "attack";  //Only here to compile correctly and check to see if the dictionary can find the right word.
    char game[4][4] = {{'a', 'b', 'c', 'd'},{'e', 'f', 'g', 'h'},{'i', 'j', 'k', 'l'},{'m', 'n', 'o', 'p'}};

    for ( i = 0; i <= 3; i++){
        for( j = 0; j <= 3; j++){                   //Takes the array and prints it out in a 4x4.
             game[i][j];
             printf("%c", game[i][j]); 
             if(j == 3){
                  printf("\n");     
             }             
        }    
    }
        
    char  tmp[256]={0x0};                  
                              
    while(Lex!=NULL && fgets(tmp, sizeof(tmp),Lex)!=NULL){      //Searches the dictionary for whatever word is and prints if matches
        if (strstr(tmp, word)){
            size_t lengthTmp = strlen(tmp);
            size_t lengthWord = strlen(word);
                if(lengthTmp - 1==lengthWord)
                    printf("%s", tmp);
               
        }
    }
                                
    if(Lex!=NULL) 
        fclose(Lex);

    system("PAUSE");	
    return 0;
}


I know I'm missing some things but I need some ideas on how to do a search method before I can fine tune the code. Any help is appreciated...Thanks in advance. Will be glad to clarify if anything is confusing.
AnswerRe: Scramble game search help Pin
Code-o-mat2-Sep-09 21:03
Code-o-mat2-Sep-09 21:03 
GeneralRe: Scramble game search help Pin
vtsmokey883-Sep-09 5:04
vtsmokey883-Sep-09 5:04 
QuestionProgram that uses LPT port to communicate with a circuit that programs a cpu! Pin
psychegr2-Sep-09 13:55
psychegr2-Sep-09 13:55 
AnswerRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
Randor 2-Sep-09 15:19
professional Randor 2-Sep-09 15:19 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
psychegr2-Sep-09 21:16
psychegr2-Sep-09 21:16 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
Randor 2-Sep-09 21:50
professional Randor 2-Sep-09 21:50 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
psychegr3-Sep-09 1:12
psychegr3-Sep-09 1:12 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
Randor 3-Sep-09 9:31
professional Randor 3-Sep-09 9:31 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
psychegr8-Sep-09 9:40
psychegr8-Sep-09 9:40 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
Randor 8-Sep-09 14:42
professional Randor 8-Sep-09 14:42 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
psychegr8-Sep-09 22:00
psychegr8-Sep-09 22:00 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
psychegr10-Sep-09 4:55
psychegr10-Sep-09 4:55 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
Randor 10-Sep-09 18:52
professional Randor 10-Sep-09 18:52 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
psychegr11-Sep-09 5:53
psychegr11-Sep-09 5:53 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
Randor 11-Sep-09 7:15
professional Randor 11-Sep-09 7:15 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
psychegr15-Sep-09 13:02
psychegr15-Sep-09 13:02 
GeneralRe: Program that uses LPT port to communicate with a circuit that programs a cpu! Pin
Randor 16-Sep-09 3:45
professional Randor 16-Sep-09 3:45 

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.