// Name: Byron Samaripa // Date:09/22/09 // Assignment: 4 // Filename: main.cpp // Description: This program plays a game of Rock-paper-scissors agains the user. // The user will input his selection and the computer will respond with a // corresponding move, it will then decide who won the round. #define _BRAIN_H // Defines Header #include #include using namespace std; // Defines constants rock, paper, scissors const int rock = 1, paper = 2, scissors = 3; int finalShowdown(int,int); int userCheck(int); int computerCheck(int); // Outputs the users selection int userCheck(int choice) { if (choice == 1) { cout << "You chose Rock!\n"; } else if (choice == 2) { cout << "You chose Paper!\n"; } else if (choice == 3) { cout << "You chose Scissors!\n"; } return 0; } // Outputs the computers selection int computerCheck(int choice) { if (choice == 1) { cout << "Computer chose Rock!\n"; } else if (choice == 2) { cout << "Computer chose Paper!\n"; } else if (choice == 3) { cout << "Computer chose Scissors!\n"; } return 0; } // Decides the winner of the game int finalShowdown(int user, int computer) { if (user == rock && computer == paper) { cout << "Paper beats Rock! You Lose!\n"; } else if (user == rock && computer == scissors) { cout << "Rock beats Scissors! You Win!\n"; } else if (user == paper && computer == rock) { cout << "Paper beats Rock! You Win!\n"; } else if (user == paper && computer == scissors) { cout << "Scissors beats Paper! You Lose!\n"; } else if (user == scissors && computer == rock) { cout << "Rock beats Scissors! You Lose!\n"; } else if (user == scissors && computer == paper) { cout << "Scissors beats Paper! You Win!\n"; } else if (user == computer) { cout << "Its a draw!\n"; } return 0; }