homework please help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phuker420
    New Member
    • Oct 2006
    • 4

    homework please help

    don't know how to get started please help with this program.

    rock,paper,scis sors

    We will write a program that multiple games of rock, paper, scissors: keeps a cumulitive score, quits when either player enters a 'Q' and declares an overall winner.

    Input: Two players enter their respective plays at the prompts. Valid input is 'R', 'P', or 'S'. The program should accept bad input with an error message.'R' beats 'S'; 'S' beats 'P', and 'P' beats 'R'. The program should record each players total number of ins as well as the number of ties. Invalid plays are not counted unless you choose to do so.

    The program should echo print the output and state the winner of each round. At the end, the scores are printed and a winner is declared.

    The purpose of this program is to demonstrate subroutines (functions) and parameter passing using both pass by value (passing a copy) and pass by reference (passing such that the parameter may be changed).
  • vninja
    New Member
    • Oct 2006
    • 40

    #2
    and are you trying to do this in C++? are there any other limits or parameters? do you need to error check for case sensitivity?

    I see this game as a couple of switch and while loops. e.g.

    loop:
    (function) get player input and change it to numerical value
    if q then let it "break;" loop and calculate winner
    (function) get both numerical values and compair them
    and have it return a 1 for win and 0 for loss to each person
    end loop if game is over (first to 10 wins, q is pressed etc.).
    (function) displays winner and total of wins/ties/losses for each person

    Comment

    Working...