



|
|
CS1 Course Site
|
Programming Challenge Archive
Incremental Programming
|
|
|
This programming challenge, the fourth, allowed us the opportunity to: use incremental programming, use, once again, problem decomposition, use a counter controle loop, use conditional constructs, as well as compose various sorts of boolean-valued expressions, and write some simple methods.
The Problem
: File CardThing.data contains a textual representation of 50 pairs of cards. Read 50 pairs of cards, where each card is represented as a rank followed by a suit. Display, to the standard output stream, the percent of the card pairs for which:
- the ranks are the same
- the suits are the same
- neither the ranks nor the suits are the same
- the cards are both red
- the cards are both black
-
Version 1
-
Version 2
-
Version 3
-
Version 4
-
Version 5
-
Versoin 6
|
|