All pastes #1586530 Raw Edit

Assignment 04 brain.h

public cpp v1 · immutable
#1586530 ·published 2009-09-30 19:29 UTC
rendered paste body
// 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 <iostream>#include <cstdlib>using namespace std;// Defines constants rock, paper, scissorsconst int rock = 1, paper = 2, scissors = 3;int finalShowdown(int,int);int userCheck(int);int computerCheck(int);// Outputs the users selectionint 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 selectionint 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 gameint 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;}