コード例 #1
0
cManager::cManager(vector<cSquare*> &vSquareVector)
{
	vector<cSquare*> vOwnedProperties;

	//Uses A Const To Determine The Amount Of Rounds
	int managerRounds[amountOfRounds];

	//Outputs A Welcoming Message To User
	cout << "Welcome To Monopoly." << endl;

	//Reads The Monopoly.txt File And Creates Pointers Of Classes
	retrieveFile(vSquareVector);

	//Uses The Amount Of Rounds Const To Determine The Random's Length
	roll(managerRounds);

	//Creates The Objects Of cPlayer Class.
	cPlayer Player1("Dog", 300, 0);
	cPlayer Player2("Car", 300, 0);

	//Uses The Amount Of Rounds To Determine Howmany Times To Loop
	for (int i = 0; i < amountOfRounds; i++)
	{
		// Splits Evenly For Each Use(Odd 1 Player , Even The Other)
		if (isOdd(i) == true)
		{
			diceLocationMove(Player1.getCurrentPosition(), managerRounds[i], Player1);
			squareLocation(Player1.getCurrentPosition(), Player1, Player2, vSquareVector);
			checkPlayerBalance(Player1);

		}
		else
		{
			diceLocationMove(Player2.getCurrentPosition(), managerRounds[i], Player2);
			squareLocation(Player2.getCurrentPosition(), Player2, Player1, vSquareVector);
			checkPlayerBalance(Player2);

		}
	}
	clearMemory(vSquareVector);
}
コード例 #2
0
ファイル: Pong.cpp プロジェクト: h2oyo/Pong
int main()

{
	std::cout << "Ready to play Pong?" << "\n";
	system("pause");

		sfw::initContext(width, height, "Pong");
	

	// then we need to update our buffers, poll for input, etc.
	while (sfw::stepContext())
	{
		
		
		Walls();
		Player1();
		Player2();
		Ball();
		if (player1score > 4)
		{
			std::cout << "Player 1 wins" << "\n" <<"Player 1 Score:" << player1score << "\n" << "Player 2 Score:" << player2score << "\n";
			sfw::termContext();
			system("pause");
		}

		if (player2score > 4)
		{
			std::cout << "Player 2 wins" << "\n" << "Player 2 Score:" << player2score << "\n" << "Player 1 Score:" << player1score << "\n";
			sfw::termContext();
			system("pause");
		}

	}
	//395 405 250 350
	sfw::termContext();
	
    return 0;
}