Archives from S:\ Drive

Good to keep around methinks
This commit is contained in:
Amrit Panesar committed 2015-04-01 21:23:15 -07:00
1 parent eadaf70b9e
commit 6dd63cc439
606 files changed
+50212

No files matched your search

@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project1", "Project1\Project1.vcxproj", "{28F4A708-4627-43EF-B148-DDA0ACBDBBC9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{28F4A708-4627-43EF-B148-DDA0ACBDBBC9}.Debug|Win32.ActiveCfg = Debug|Win32
{28F4A708-4627-43EF-B148-DDA0ACBDBBC9}.Debug|Win32.Build.0 = Debug|Win32
{28F4A708-4627-43EF-B148-DDA0ACBDBBC9}.Release|Win32.ActiveCfg = Release|Win32
{28F4A708-4627-43EF-B148-DDA0ACBDBBC9}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,67 @@
#include <iostream>
#include <string>
#include "Player.h"
using namespace std;
Player::Player(int score, int health, string name)
{
setScore(score);
setHealth(health);
setName(name);
}
void Player::setScore(int score)
{
if ( score <= 0 )
{
score = 0;
}
iScore = score;
}
int Player::getScore()
{
if ( iScore <= 0 )
{
iScore = 0;
}
return iScore;
}
void Player::setHealth(int health)
{
if ( health >= 0 && health <= 100 )
{
iHealth = health;
}
}
int Player::getHealth()
{
if ( iHealth <= 0 )
{
iHealth = 0;
}
if ( iHealth >= 100 )
{
iHealth = 100;
}
return iHealth;
}
void Player::setName(string name)
{
sName = name;
}
string Player::getName()
{
return sName;
}
void Player::display()
{
cout << "\tScore: " << getScore() << endl;
cout << "\tHealth: " << getHealth() << endl;
}
@@ -0,0 +1,23 @@
#include <string>
using namespace std;
class Player {
private:
int iScore;
int iHealth;
string sName;
public:
Player(int score, int health, string name);
void setScore(int score);
int getScore();
void setHealth(int health);
int getHealth();
string getName();
void setName(string Name);
void display();
};
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{28F4A708-4627-43EF-B148-DDA0ACBDBBC9}</ProjectGuid>
<RootNamespace>Project1</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Player.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="Player.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Player.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Player.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
@@ -0,0 +1,87 @@
/*****************************************************************************
* Program: player *
* Author: Amrit Panesar <apanesar@coleman.edu> *
* Date: 08/04/2014 *
* Description: Setup, instantiate, and access player functions *
*****************************************************************************/
#include <string>
#include <iostream>
#include <conio.h>
#include <ctime>
#include "Player.h"
using namespace std;
bool pause();
int main(const char* argv, int argc)
{
srand((unsigned int) time(NULL));
string in;
char choice;
while (true)
{
cout << "What would you like your player to be named?" << endl << ":";
cin >> in;
while (true) {
cout << "You want to name your player " << in << ". Is that correct?" << endl << ":[Y/n] ";
int i = getch();
if ((char)i == 'y' || (char)i == 'Y' || (char)i == 'n' || (char)i == 'N' )
{
choice = i;
break;
}
cout << "Please enter either Y or N" << endl << ":[Y/n] ";
}
if (choice == 'Y' || choice == 'y' || choice == 'n' || choice == 'N')
break;
}
while (choice == 'Y' || choice == 'y')
{
Player p1((((rand()%509)*(rand()%349))%101), (((rand()%509)*(rand()%349))%101), in);
cout << p1.getName() << " recieved " << p1.getScore() << " points with " << p1.getHealth() << " points of health!" << endl << endl;
while (true)
{
while (true) {
cout << "Would you like to play again? " << endl << ":[Y/n] ";
int i = getch();
if ((char)i == 'y' || (char)i == 'Y' || (char)i == 'n' || (char)i == 'N' )
{
choice = i;
break;
}
cout << "Please enter either Y or N" << endl;
}
if (choice == 'Y' || choice == 'y' || choice == 'n' || choice == 'N')
break;
}
cout << endl;
if (choice == 'n' || choice == 'N')
{
break;
}
}
pause();
}
bool pause()
{
enum { NUL = 0, SOH, STX, ETX, EOT, ENQ, ACK, BEL, BS, HT,
LF, VT, FF, CR, SO, SI, DLE, DC1, DC2, DC3, DC4, NAK,
SYN, ETB, CAN, EM, SUB, ESC, FS, GS, RS, US, DEL = 127 };
cout << "Press any key to continue..." << endl << endl;
int i = getch();
if ( i == ETX || i == ESC ) // control + c || escape
{
return true;
}
return false;
}