Thread: Practice...
View Single Post
Old 02-11-2005, 04:34 PM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
A little OOD practice:
- Provide an interface to sort an array of std::strings of such nature that:
a) the user is able to sort using BubbleSort or a more advanced sorting routine.
b) the user is able to choose between sorting by ascending order or descending order.

- Use the Template Method to implement the sorting order interface.
- Use the Strategy Pattern to implement the choice between the two sorting algorithms.
- Use the Command Design pattern to create a "Console GUI" so the user can choose with menu's and submenus:
1) BubbleSort -> [ 1) Ascending order, 2) Descending order 3) Back to main menu ]
2) CombSort-> [ 1) Ascending order, 2) Descending order 3) Back to main menu ]
3) Exit

- In main(), just create an array of std::string with leadertypes. E.g.
string sLeaderTypes[] = {"Emperor", "King", "Warlord", "President", ...etcetera};
Use this as a test case.
- Use header and source files.

If you don't know how, we'll do it bit by bit illustrating the problems and its solution.
__________________
Valmont is offline   Reply With Quote