All pastes #2111020 Raw Edit

Something

public text v1 · immutable
#2111020 ·published 2012-02-08 04:14 UTC
rendered paste body
/**
 * Problem a3c1p1
 * Written by: Scott Giles
 * Program Description: A 2 player game. Both players input a number 1-5.
 * 						If the total of both nubmers if even, player 1 wins.
 *						If odd, player 2 wins.
 **/
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int main( )
{
	int player1, player2, total;
	cout << "WELCOME TO THE GAME." << endl;
	cout << "Player 1, please enter a number between 1 and 5: ";
	cin >> player1;
	if(player1 < 1 || player1 > 5){
		cout << "Sorry Charlie, but "<<player1<<" isn't between 1 and 5!" << endl;
		exit(1);
	}
	cout << "Player 2, please enter a number between 1 and 5: ";
	cin >> player2;
	if(player2 < 1 || player2 > 5){
		cout << "Sorry Charlie, but "<<player1<<" isn't between 1 and 5!" << endl;
		exit(1);
	}
	total = player1 + player2;
	if((total % 2) == 0){
		cout << "The sum, "<<total<<", is even so player 1 wins.";
	} else {
		cout << "The sum, "<<total<<", is odd so player 1 wins.";
	}
	
	return 0;
}