Thread: 1-800-contest

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    11

    Question 1-800-contest

    DEVELOPE A PHONE SPELL
    sample input and output:
    combinations:

    exp:1
    input:1-800-2668378
    output:
    1-800-A-NO-TEST
    1-800-A-NO-VEST
    1-800-A-NO-TEST
    1-800-A-ON-VEST
    1-800-AM-OVERT
    1-800--BOO-VEST
    1-800--BOO-TEST
    1-800-CONTEST
    1-800-CONVERT
    1-800-COO-TEST

    exp 2:
    i/p:1-800--0000000
    o/p:1-800--0000000

    exp 3:
    i/p:1-800--1000000
    o/p:1-800--1000000

    Proble:
    NOs from 2 to8 corresponds to the alphabets written like in the telphone for storing names
    given a string of input:1-800-2668378 and all possible combination of words are shown.
    for string -2668378
    hint :use a dictionary file

    1-800- is common for all strings
    if no correspond to more than one word use to saperate them
    if no has 0 or 1 put at same pos
    Last edited by tanmay_solanki; 08-27-2007 at 02:14 AM. Reason: clarifiaction

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    And what are you asking?

    See the homework policy before posting your question.

  3. #3
    Registered User
    Join Date
    Aug 2007
    Location
    Barbados
    Posts
    31
    I think you want something to print all possible numbers(in words)
    like
    1 800 FOO BAR
    How many digits do these American numbers have?
    I am accostomed to 7 digit numbers.
    Hm...You DO realize that there will be 2^(7*3) + (2^2) combinations right?
    Or do they have to be actual words?
    I will attempt this, and post if I ever get it working.

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Out of simplicity the numbers are:

    2 = A, B, C
    3 = D, E, F
    4 = G, H, I
    5 = J, K, L
    6 = M, N, O
    7 = P, Q, R, S
    8 = T, U, V
    9 = W, X, Y, Z

    As sea_4_ever said, the combination of letters is rather large. Do the letters have to make a word?

  5. #5
    Registered User
    Join Date
    Aug 2007
    Posts
    11
    look the example again.
    The search will start after 1-800- from input string and from the 8th exp(2)charcter of input will use a dic.
    file to go to the (a or b or c)'s index and will start matching rest of 9th character to last searching for word.
    use - to saperate words

  6. #6
    Registered User
    Join Date
    Aug 2007
    Posts
    11
    Quote Originally Posted by sea_4_ever View Post
    I think you want something to print all possible numbers(in words)
    like
    1 800 FOO BAR
    How many digits do these American numbers have?
    I am accostomed to 7 digit numbers.
    Hm...You DO realize that there will be 2^(7*3) + (2^2) combinations right?
    Or do they have to be actual words?
    I will attempt this, and post if I ever get it working.
    look the example again.
    The search will start after 1-800- from input string and from the 8th exp(2)charcter of input will use a dic.
    file to go to the (a or b or c)'s index and will start matching rest of 9th character to last searching for word.
    use - to saperate words

  7. #7
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Seriously, if it's a contest work it out for yourself. If it's homework ask specific questions.

  8. #8
    Registered User
    Join Date
    Aug 2007
    Posts
    11
    it's not a contest.
    logic to develope a program like site www.phonespell.org in c

  9. #9
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Contests should be posted on the Contests Board. However, this sounds like a homework question. As stated earlier, read the homework policy and attempt it yourself first.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  10. #10
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Design it first on paper, the actual C implementation is trivial.

    Consider, a flow chart, NS chart and an IPO chart.
    Last edited by zacs7; 08-27-2007 at 02:56 AM. Reason: Spellingz lolzez

  11. #11
    Registered User
    Join Date
    Aug 2007
    Posts
    11

    Unhappy

    need some start

  12. #12
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    Then...START !

    No one is going to that for you. People here have given you already many paths to explore...
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  13. #13
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    How about beginning with the basics of reading in a phone number, then printing out the digits which are of interest.

    If you can do that bit, then try and do the next bit which associates digits with letters.

    If not, then post what you've achieved so far and we'll take it from there.

    There's no point us explaining the details of the algorithm if just reading in the string is beyond you.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  14. #14
    Registered User
    Join Date
    Aug 2007
    Posts
    11

    Unhappy

    I able to get string when one word string is present in dictionary as my result
    but could get when two saperate words correspons to my result string

  15. #15
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Well, as Salem said -- Why don't you post what you've got so far?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Expression Evaluator Contest
    By Stack Overflow in forum Contests Board
    Replies: 20
    Last Post: 03-29-2005, 10:34 AM
  2. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  3. WANTED: Contest Master
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-23-2003, 10:15 PM