CSE 332 Lab 2: Cards, Hands, and Scores
Lab dates: Wednesday February 3 and Wednesday February 10, 2010
Due by Tuesday February 16 at 11:59 pm (deadline for e-mailing a zip file with your
Final grade percentage: 5 percent
This lab is intended to extend your use of basic C++ language features from the previous lab, and to
introduce more advanced techniques like the use of member operators and algorithms from the C++ STL,
adding a less-than comparison operator (
) to a struct, and
using the STL sort algorithm to order objects
To do this, you will implement a simple C++ program that can (1) read sets of 5 cards from a file, sort the
cards in each set into ascending order by rank and then suit, and then assign a score to the set based on its
rank in poker (assuming a single standard 52 card deck with no wild cards).
In this lab and in the subsequent labs, you are encouraged to re-use and modify code from your
previous lab solutions - if you choose do this, please put a completely new copy of any header and
source files from your previous lab(s) in the new lab project directory you create.
This can avoid some
potential for error or confusion within Visual Studio, and also ensures you have a backup copy that you could
go back to if a modification you try doesn't pan out.
Part I - Readings:
1. The following readings in the optional text books may be useful as reference material while working
on this lab assignment, and though we'll touch on most of the issues in the next few studio sessions,
selectively looking up topics and/or reading ahead (on demand as you encounter issues while working
on the lab) is encouraged:
STL sort algorithm: Prata pp. 885-889; Deitel 7th Ed. pp. 970-972
file streams: Prata pp. 1003-1008; Deitel 7th Ed. pp. 717-721
2. The C++ string class, file input and output stream, and input and output stringstream examples in the
C++ Data and I/O lecture slides
also again may be helpful when implementing parts this lab.
3. Please read the following
CSE 332 Programming Guidelines
which are again relevant to this lab as
well as the previous one, and please follow them as you implement your solution: A.1-A.6, A.9-A.11,
A.17, B.7, B.9, B.13, B.15, B.16, B.20-B.23, B.25, B.30, B.33, B.34, C.1-C.4 and C.6-C.9.