By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,778 Members | 1,919 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,778 IT Pros & Developers. It's quick & easy.

C++ puzzle

P: n/a
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.
Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Jason" <ja*********@yahoo.com> wrote...
Write a program that [...]


Do your own homework.
Jul 19 '05 #2

P: n/a
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

Jul 19 '05 #3

P: n/a

"Jason" <ja*********@yahoo.com> wrote in message
news:b3**************************@posting.google.c om...
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
Jul 19 '05 #4

P: n/a
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

Jul 22 '05 #5

P: n/a
"Chris Theis" <Ch*************@nospam.cern.ch> wrote in message news:<bp**********@sunnews.cern.ch>...
"Jason" <ja*********@yahoo.com> wrote in message
news:b3**************************@posting.google.c om...
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

Jul 22 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.