directory structure change, organize by class number as opposed to mod number

Signed-off-by: Amrit Panesar <apanesar@4195tech.com>
This commit is contained in:
Amrit Panesar committed 2015-04-12 23:49:33 -07:00
1 parent 2a3d6fc042
commit 8683384387
480 files changed
+7

No files matched your search

@@ -0,0 +1,73 @@
#include <ctime>
#include "Player.h"
Player::Player()
{
score = 0;
health = 0;
name = "";
}
void Player::setHealth(float fHealth)
{
if (fHealth > 100)
fHealth = 100;
else if (fHealth < 0)
fHealth = 0;
health = fHealth;
}
float Player::getHealth()
{
return health;
}
int Player::getScore()
{
return score;
}
void Player::setScore(int iScore)
{
score = iScore;
}
void Player::setName( string sName )
{
name = sName;
}
string Player::getName()
{
return name;
}
void Player::display()
{
cout << "Player has " << getHealth() << " health and a score of " << getScore() << endl;
}
void Player::run()
{
cout << "Would you like to play a game?\n:";
char playG;
cin >> playG;
while (playG == 'y' || playG == 'Y')
{
int thisScore = 0;
int cScore = 0;
int wCount = 0;
while (wCount < 5)
{
srand((unsigned int)time(NULL)+rand()%30+rand()%100);
thisScore += rand() % 100 + 1;
wCount++;
}
setScore(thisScore);
cout << "Player 1: " << getName() << ", your score is: " << getScore() << endl;
cout << "Would you like to play again?\n:";
cin >> playG;
}
}