Thread: Searching a BST help

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    15

    Searching a BST help

    So far my program is working except for one condition. If the 1st file you read in has for example the word "computer" then if the second file has either "computer" or "Computer" then the word should be considered correctly spelled. If the 1st file has "Computer" then the second file must have "Computer" in it as well to be considered correctly spelled. My program does not work for the former.
    Last edited by MasterAchilles; 04-18-2008 at 08:11 PM.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    So "computer" in the file must match "computer" while "Computer" in the file must match either "Computer" or "computer". This leads pretty quickly and obviously to the idea that you should check the word you have and the word you get by doing tolower() on the first character.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    15
    Quote Originally Posted by tabstop View Post
    So "computer" in the file must match "computer" while "Computer" in the file must match either "Computer" or "computer". This leads pretty quickly and obviously to the idea that you should check the word you have and the word you get by doing tolower() on the first character.
    For some reason though it returns my NONE value for Computer even though computer is in my first file.

    1st file: If Computer then, 2nd file can have only Computer to be correct.
    1st file has computer then 2nd file can have either Computer or computer.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by MasterAchilles View Post
    For some reason though it returns my NONE value for Computer even though computer is in my first file.

    1st file: If Computer then, 2nd file can have only Computer to be correct.
    1st file has computer then 2nd file can have either Computer or computer.
    Do you mean with the code you have posted? Because that only checks the word itself -- it does NOT check any variants of the word. You much check both the word you have and the word you get by doing tolower() on the first letter.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I would love some input on my BST tree.
    By StevenGarcia in forum C++ Programming
    Replies: 4
    Last Post: 01-15-2007, 01:22 AM
  2. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 05:20 AM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Visual C++ 2005 linking and file sizes
    By Rune Hunter in forum C++ Programming
    Replies: 2
    Last Post: 11-12-2005, 10:41 PM