C++ puzzle

Discussion in 'C++' started by Jason, Nov 17, 2003.

  1. Jason

    Jason Guest

    Write a program that allows users type in an emoticon and displays the
    description of the emoticon on the screen. For example, using the
    table above, if the user enters :C your program should display "Very
    Sad Smiley" on the screen.
    The program should allow the user enter as many emoticons as they wish
    (one at a time, of course). The user will indicate that they want to
    finish by entering "-_-" (i.e. the ‘bored' emoticon).
    You can decide which emoticons will be supported by your program.
    However, if an emoticon entered by a user is not one of the entries in
    your list you should provide a mechanism to allow the user add it to
    the list if they want to. To add an entry the user must provide the
    emoticon and a description.
    You should allow for up to 150 entries in the list. Assume the
    emoticon can be up to 10 characters long and the descriptions up to 50
    characters long. It would be helpful if your solution allowed these
    values (i.e. 150, 10, 50) to be altered easily.
    Jason, Nov 17, 2003
    #1
    1. Advertising

  2. "Jason" <> wrote...
    > Write a program that [...]


    Do your own homework.
    Victor Bazarov, Nov 17, 2003
    #2
    1. Advertising

  3. On Mon, 17 Nov 2003 06:55:00 -0800, Jason wrote:

    > Write a program that allows users type in an emoticon and displays the
    > description of the emoticon on the screen. For example, using the
    > table above, if the user enters :C your program should display "Very
    > Sad Smiley" on the screen.
    > The program should allow the user enter as many emoticons as they wish
    > (one at a time, of course). The user will indicate that they want to
    > finish by entering "-_-" (i.e. the ‘bored' emoticon).
    > You can decide which emoticons will be supported by your program.
    > However, if an emoticon entered by a user is not one of the entries in
    > your list you should provide a mechanism to allow the user add it to
    > the list if they want to. To add an entry the user must provide the
    > emoticon and a description.
    > You should allow for up to 150 entries in the list. Assume the
    > emoticon can be up to 10 characters long and the descriptions up to 50
    > characters long. It would be helpful if your solution allowed these
    > values (i.e. 150, 10, 50) to be altered easily.


    Homework hints:

    Make a struct cointaining to strings, one for emoticons and one for the
    corresponding description.

    For extra credit use std::string

    Make a list of the structs. For extra credit use a vector instead of an
    array of length 150.

    Read input. Search the list if you find the emoticon output the result if
    not ask for a description and make a new entry in the list.

    For extra credit make the program store the list in a file and read it
    when starting.

    --
    NPV

    "the large print giveth, and the small print taketh away"
    Tom Waits - Step right up
    Nils Petter Vaskinn, Nov 17, 2003
    #3
  4. Jason

    Chris Theis Guest

    "Jason" <> wrote in message
    news:...
    > Write a program that allows users type in an emoticon and displays the
    > description of the emoticon on the screen.


    Yes, I obeyed your orders Sir! What else can I do to please you?

    How darn stupid do you take us for that we do your homework. Posting just
    the assignment without any comment of yourself or some code where you tried
    and probably failed might be considered even beyond rudeness!

    Chris
    Chris Theis, Nov 17, 2003
    #4
  5. Jason

    Jon Bell Guest

    In article <>,
    Nils Petter Vaskinn <> wrote:
    >
    >Read input. Search the list if you find the emoticon output the result if
    >not ask for a description and make a new entry in the list.


    For extra credit use a map instead of an array or vector, to make the
    searching trivial. ;-)

    --
    Jon Bell <> Presbyterian College
    Dept. of Physics and Computer Science Clinton, South Carolina USA
    Jon Bell, Nov 17, 2003
    #5
  6. On Mon, 17 Nov 2003 17:31:56 +0000, Jon Bell wrote:

    > For extra credit use a map instead of an array or vector, to make the
    > searching trivial. ;-)


    Pity that threads and GUI libraries are offtopic, we could have mad him
    have a nice pointy clicky interface on the thing, and images for the
    smilys. Or perhaps he should use a database backend for efficient
    searching from multiple clients one the list grows to a few thousand
    elements?

    --
    NPV

    "the large print giveth, and the small print taketh away"
    Tom Waits - Step right up
    Nils Petter Vaskinn, Nov 18, 2003
    #6
  7. Jason

    Cavello Guest

    "Chris Theis" <> wrote in message news:<bpaokr$e2r$>...
    > "Jason" <> wrote in message
    > news:...
    > > Write a program that allows users type in an emoticon and displays the
    > > description of the emoticon on the screen.

    >
    > Yes, I obeyed your orders Sir! What else can I do to please you?
    >
    > How darn stupid do you take us for that we do your homework. Posting just
    > the assignment without any comment of yourself or some code where you tried
    > and probably failed might be considered even beyond rudeness!


    Pipe down. If you don't wanna do it, don't. If you do, do.

    >
    > Chris
    Cavello, Nov 18, 2003
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Earl Teigrob
    Replies:
    3
    Views:
    6,636
    Nedu N
    Aug 6, 2003
  2. dwa

    Design Puzzle!

    dwa, Jun 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    360
    Cowboy \(Gregory A. Beamer\) [MVP]
    Jun 10, 2004
  3. Shankara Narayanan

    Booking puzzle....

    Shankara Narayanan, Jun 17, 2004, in forum: ASP .Net
    Replies:
    20
    Views:
    909
    bredal Jensen
    Jun 30, 2004
  4. VB Programmer
    Replies:
    2
    Views:
    424
    Alan Lambert
    Nov 4, 2004
  5. G. Stewart

    regex puzzle!

    G. Stewart, Nov 23, 2004, in forum: ASP .Net
    Replies:
    8
    Views:
    500
    G. Stewart
    Nov 25, 2004
Loading...

Share This Page