Thread: scaning a word

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    192

    scaning a word

    Hi i was wondering what is the best and fastest method to scan a word like

    "dooDooo"

    so i guess a char* would point to that word and i want to scan the whole word but what im looking for are teh capitol letters? how do i do a quick search if the word has a capital letter?

  2. #2
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    you'll have to look through each letter until you find a capital letter, the best you'll be able to do is O(n)
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    192
    Well i was asking how do i check like what would the algorithm be in pesudo code to check each letter and see if its a capital letter

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by kiros88 View Post
    Well i was asking how do i check like what would the algorithm be in pesudo code to check each letter and see if its a capital letter
    Yes, you would have to go letter by letter.

    In the various libaries for C are a number of functions you can use to test each one... isalpha() for one, isupper() is lower(), isblank() and so on... Look through the libraries you'll be amazed how complete they are.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  2. please help with binary tree, urgent.
    By slickestting in forum C Programming
    Replies: 2
    Last Post: 07-22-2007, 07:55 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. Wrong Output
    By egomaster69 in forum C Programming
    Replies: 7
    Last Post: 01-28-2005, 06:44 PM
  5. Using 'if' with char arrays or string objects
    By c++_n00b in forum C++ Programming
    Replies: 36
    Last Post: 06-06-2002, 09:04 PM