C++ puzzle

J

Jason

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.
 
N

Nils Petter Vaskinn

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.
 
C

Chris Theis

Jason said:
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
 
J

Jon Bell

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. ;-)
 
N

Nils Petter Vaskinn

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?
 
C

Cavello

Chris Theis said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top