CSCI 261 - Programming Concepts (C++)

Fall 2017 - Lab 2C

Quick Links: Canvas | CS @ Mines | Cloud9 | Piazza | zyBooks

|   Home |  Contact |  Syllabus |  Assignments |  Schedule |  Resources   |
This lab is due by Tuesday, September 12, 2017 11:59 PM .

Make a copy of Lab2B's main.cpp and place it as the starting point for Lab2C.


Rock Paper Scissors Part II



At the end of Lab2B, our program looked like follows:

Welcome one and all to a round of Rock, Paper, Scissors! (Enter P, R or S)
Player one: S

Player choose S
Computer choose 1

This could work, but it is somewhat cryptic. Will R beat 1? We don't know. We need to convert both players' choices into intelligble output. We'll start with the Human player first. Instead of printing back whatever the Human entered, we want to convert the single letter entered into the full word that it corresponds to.

Welcome one and all to a round of Rock, Paper, Scissors! (Enter P, R or S)
Player one: S

Player choose Scissors
Computer choose 1

Welcome one and all to a round of Rock, Paper, Scissors! (Enter P, R or S)
Player one: P

Player choose Paper
Computer choose 1

Great! We're one third of the way there. Next, we'll decode what the Computer Player is doing. Instead of displaying 0, 1, or 2, your program should instead print Rock, Paper, or Scissors respectively. At this point, we now will know what each player has thrown:

Welcome one and all to a round of Rock, Paper, Scissors! (Enter P, R or S)
Player one: P

Player choose Paper
Computer choose Paper

Welcome one and all to a round of Rock, Paper, Scissors! (Enter P, R or S)
Player one: P

Player choose Paper
Computer choose Scissors

Wonderful, almost done! Since we are good little programmers, we know that our user may not always follow instructions exactly as we state. We want to handle the situation when the user accidently types a lower case letter. Now the Human Player can enter either R or r for rock, P or p for paper, and S or s for scissors. Your program will now be:

Welcome one and all to a round of Rock, Paper, Scissors! (Enter P, R or S)
Player one: p

Player choose Paper
Computer choose Rock

And we're done with Part C! On to the last part, for Lab2D.


Lab Submission



You will submit your solution to this lab with the rest of A2. Detailed instructions for doing this are posted in Assignment 2.


This lab is due by Tuesday, September 12, 2017 11:59 PM .
Last Updated: 08/29/17 17:38


Valid HTML 4.01 Strict Valid CSS! Level Triple-A conformance, W3C WAI Web Content Accessibility Guidelines 2.0