int comparePathChar(char a, char b) const { if(a >= 'a' && a <= 'z') a += 'A'-'a'; else if(a == '\\') a = '/'; if(b >= 'a' && b <= 'z') b += 'A'-'a'; else if(b == '\\') b = '/'; return compareChar(a,b); }
/** findLinkedList * input : * * * output : * **/ int findLinkedList(LinkedList **listPtr, void *data, int(*compareChar)(void *dataInCollection, void *data)) { LinkedList *head = *listPtr; if(head != NULL) { if(compareChar(head->data, data)) return 1; } return 0; }
bool operator<(const Gene& g) const { if( (compareChar(chrom.c_str(), g.getChr().c_str()) < 0) || (hs == g.getHS() && entrez_ID < g.getEID()) || (hs == g.getHS() && entrez_ID == g.getEID() && start_p < g.getStart()) || (hs == g.getHS() && entrez_ID == g.getEID() && start_p == g.getStart() && stop_p < g.getStop()) ) return true; else return false; }
int main( int argc, char ** argv ) { //Declarations IplImage * template_img; IplImage * plate_img; int numContours; plateInfo * plate_info; charInfo * char_info; char** plate_number; char pNumber[7]; int i; if( argc < 5 ) exit (0); else { char *state = findState(argv); //Load template image template_img = cvLoadImage( argv[1], CV_LOAD_IMAGE_GRAYSCALE); //Load original license image plate_img = cvLoadImage( argv[2], CV_LOAD_IMAGE_COLOR ); plate_info = processPlateChars( plate_img ); char_info = processTemplateChars( template_img, &numContours ); plate_number = compareChar( char_info, plate_info, &numContours ); //Mkay, this should do it.. //Print that bad boy! printf("\nPlate number: "); for(i = 1; i < 8; i++) { printf("%s", plate_number[i]); strcpy((pNumber + (i-1)), plate_number[i]); } printf("\n"); // char * number = pNumber[6]; printf("%s", pNumber); Owner owner; owner = newOwner(state, pNumber); WriteToXML(owner); return EXIT_SUCCESS; } }
int compareString(const char *a, const char *b) const { while(*a && *b) { int i = comparePathChar(*a,*b); if(i != 0) return i; a++; b++; } // At this point, one or both of the chars is a null terminator. // Normal char comparison will get the correct final result here. return compareChar(*a,*b); }
LinkedList *findItemInList(LinkedList **listPtr, void *data, int(*compareChar)(void *dataInCollection, void *data)) { LinkedList *currentPtr = *listPtr; while(currentPtr != NULL) { if(compareChar(currentPtr->data, data)) return currentPtr; currentPtr = currentPtr->next; } //printf("Item Not Found In The List\n"); return NULL; }
int main(int argc, char * argv[]) { Game game = {FALSE, 0}; char guesses[80]; int wordLength; int dashes; int incorrectGuesses; int maxTries; while(game.gameOver == FALSE) { char * word; char * ptr; wordLength = 0; dashes = 0; incorrectGuesses = 0; maxTries = 15; wordLength = selectWord(game.randomWord); /* Selecting random word */ word = game.randomWord; /* Assigning word to the randomWord */ ptr = strchr(word,'\n'); /* Getting rid of the new line */ *ptr = '\0'; for (dashes = 0; dashes < wordLength; dashes ++) /* For loop to print out the dashes */ { guesses[dashes] = DASH; } printWelcomeMessages( wordLength ); char input; while(game.gameOver == FALSE) { printf("Number of guesses: %i\n",incorrectGuesses); printf("Number of tries left: %i\n",(maxTries - incorrectGuesses)); printLettersGuessed( &game, game.totalGuesses ); printf( "Guess a letter: "); scanf( " %c", &input ); if (input == '\n' || input == ' ') { input = getchar(); } game.lettersGuessed[game.totalGuesses] = input; game.totalGuesses++; if (compareChar(input,word,guesses)) { printf("\n\nYou guessed '%c' correctly\n\n",input); } else { printf("\n\nSorry, '%c' is not a letter in the word\n\n",input); incorrectGuesses++; } printChar(guesses,wordLength); if (!gameOver(game.numRight,wordLength,guesses)) { system("clear"); printf("Congratulations! You have correctly guessed '%s'!\n\n",guesses); break; } if (incorrectGuesses == maxTries) { system("clear"); printf("GAME OVER!\nYou have failed to guess '%s'\n\n",word); break; } } newGame(game,guesses); } return 0; }
int comparePathChar(char a, char b) const { if(a == '\\') a = '/'; if(b == '\\') b = '/'; return compareChar(a,b); }