Homework 2, A Mini Contest
Short Description:
Write two programs that use vectors
Goals
When you finish this homework, you should have:
- Used vectors to solve several problems.
Formal Description
I have selected two relatively simple programming contest programs which can be solved using vectors. You should create solutions to these problems using vectors. If you wish to test your solutions on Kattis, a link is given at the bottom of each problem statement.
Please solve these two problems using vectors:
- Word Cloud
- A vector of classes.
- This is object oriented programming. Use a class or two.
- This is more of a reading problem than a math problem. The math is not that bad.
- Name your solution file wordcloud.C or wordcloud.cpp.
- Even though this has a higher rating, it is a simpler problem (IMHO)
- Be careful with casting/coercion. Make sure you DO THE EXAMPLES and understand how the program designers did the math.
- You can get into an end of file like problem (but not with input, but with a form of output).
- The write up is correct. The behavior of words and fonts is unexpected, but implement the math correctly and all is well.
- If a word is longer than the line length given, place it on a line by itself.
- Fast Food Prizes
- You want a vector of classes for this one.
- The class should probably have a vector member.
- Handle the input then worry about the solution.
- Name your solution file fastfood.C or fastfood.cpp.
- Using a class or two may be a bit overkill, a struct might do, but this is object oriented programming after all. USE CLASSES.
Notes
- All input should be from standard in (cin)
- All output should be to standard out (cout)
- You do not need to validate input. All input will be valid and within the set limits.
- You must use vectors in your solution.
- You may use find, sort from the standard algorithm library. (But you might not need them).
- Use the following Makefile
- You would be silly not to do a design for these programs, even though they are short.
- If you need help with an algorithm let me know.
- If you like this type of problem you might consider the programming contest team.
- On a scale from 1 to 10, where 1 is easy and 10 is hard
- Word Cloud is rated 2.3
- Fast Food Prizes is rated 2.2
Required Files
A single tar or zip file containing the source code and makefile for these program.
Submission
Submit your tar or zip file to the D2L folder Homework 2 by the due date.