Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Lab_03/Debug/Lab_03.exe
Binary file not shown.
Binary file added Lab_03/Debug/Lab_03.ilk
Binary file not shown.
Binary file added Lab_03/Debug/Lab_03.pdb
Binary file not shown.
Binary file added Lab_03/Lab_03.sdf
Binary file not shown.
22 changes: 22 additions & 0 deletions Lab_03/Lab_03.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lab_03", "Lab_03\Lab_03.vcxproj", "{5AEED483-6248-4FE6-A1CA-AB383BBBF620}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5AEED483-6248-4FE6-A1CA-AB383BBBF620}.Debug|Win32.ActiveCfg = Debug|Win32
{5AEED483-6248-4FE6-A1CA-AB383BBBF620}.Debug|Win32.Build.0 = Debug|Win32
{5AEED483-6248-4FE6-A1CA-AB383BBBF620}.Release|Win32.ActiveCfg = Release|Win32
{5AEED483-6248-4FE6-A1CA-AB383BBBF620}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added Lab_03/Lab_03.v12.suo
Binary file not shown.
7 changes: 7 additions & 0 deletions Lab_03/Lab_03/Debug/Lab_03.Build.CppClean.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
c:\users\ieuser\documents\visual studio 2013\projects\lab_03\lab_03\debug\lab_03.pch
c:\users\ieuser\documents\visual studio 2013\projects\lab_03\lab_03\debug\vc120.pdb
c:\users\ieuser\documents\visual studio 2013\projects\lab_03\lab_03\debug\vc120.idb
c:\users\ieuser\documents\visual studio 2013\projects\lab_03\lab_03\debug\stdafx.obj
c:\users\ieuser\documents\visual studio 2013\projects\lab_03\lab_03\debug\lab_03.tlog\cl.command.1.tlog
c:\users\ieuser\documents\visual studio 2013\projects\lab_03\lab_03\debug\lab_03.tlog\cl.read.1.tlog
c:\users\ieuser\documents\visual studio 2013\projects\lab_03\lab_03\debug\lab_03.tlog\cl.write.1.tlog
16 changes: 16 additions & 0 deletions Lab_03/Lab_03/Debug/Lab_03.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Build started 1/28/2015 4:40:36 AM.
Project "c:\Users\IEUser\documents\visual studio 2013\Projects\Lab_03\Lab_03\Lab_03.vcxproj" on node 2 (Rebuild target(s)).
ClCompile:
C:\Program Files\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yc"stdafx.h" /Fp"Debug\Lab_03.pch" /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt stdafx.cpp
stdafx.cpp
C:\Program Files\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yu"stdafx.h" /Fp"Debug\Lab_03.pch" /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt Lab_03.cpp
Lab_03.cpp
Link:
C:\Program Files\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"c:\users\ieuser\documents\visual studio 2013\Projects\Lab_03\Debug\Lab_03.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"c:\users\ieuser\documents\visual studio 2013\Projects\Lab_03\Debug\Lab_03.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"c:\users\ieuser\documents\visual studio 2013\Projects\Lab_03\Debug\Lab_03.lib" /MACHINE:X86 Debug\Lab_03.obj
Debug\stdafx.obj
Lab_03.vcxproj -> c:\users\ieuser\documents\visual studio 2013\Projects\Lab_03\Debug\Lab_03.exe
Done Building Project "c:\Users\IEUser\documents\visual studio 2013\Projects\Lab_03\Lab_03\Lab_03.vcxproj" (Rebuild target(s)).

Build succeeded.

Time Elapsed 00:00:00.78
Binary file added Lab_03/Lab_03/Debug/Lab_03.obj
Binary file not shown.
Binary file added Lab_03/Lab_03/Debug/Lab_03.pch
Binary file not shown.
Binary file added Lab_03/Lab_03/Debug/Lab_03.tlog/CL.read.1.tlog
Binary file not shown.
Binary file added Lab_03/Lab_03/Debug/Lab_03.tlog/CL.write.1.tlog
Binary file not shown.
2 changes: 2 additions & 0 deletions Lab_03/Lab_03/Debug/Lab_03.tlog/Lab_03.lastbuildstate
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
Debug|Win32|c:\users\ieuser\documents\visual studio 2013\Projects\Lab_03\|
Binary file added Lab_03/Lab_03/Debug/Lab_03.tlog/cl.command.1.tlog
Binary file not shown.
Binary file not shown.
Binary file added Lab_03/Lab_03/Debug/Lab_03.tlog/link.read.1.tlog
Binary file not shown.
Binary file added Lab_03/Lab_03/Debug/Lab_03.tlog/link.write.1.tlog
Binary file not shown.
Binary file added Lab_03/Lab_03/Debug/stdafx.obj
Binary file not shown.
Binary file added Lab_03/Lab_03/Debug/vc120.idb
Binary file not shown.
Binary file added Lab_03/Lab_03/Debug/vc120.pdb
Binary file not shown.
152 changes: 152 additions & 0 deletions Lab_03/Lab_03/Lab_03.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
// Lab_03.cpp : Defines the entry point for the console application.
//


#include "stdafx.h"
#include <iostream>
using namespace std;

char square[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };

int checkwin();
void board();

int main()
{
int player = 1, i, choice;

char mark;
do
{
board();
player = (player % 2) ? 1 : 2;

cout << "Player " << player << ", enter a number: ";
cin >> choice;


mark = (player == 1) ? 'X' : 'O';

if (choice == 1 && square[1] == '1')

square[1] = mark;
else if (choice == 2 && square[2] == '2')

square[2] = mark;
else if (choice == 3 && square[3] == '3')

square[3] = mark;
else if (choice == 4 && square[4] == '4')

square[4] = mark;
else if (choice == 5 && square[5] == '5')

square[5] = mark;
else if (choice == 6 && square[6] == '6')

square[6] = mark;
else if (choice == 7 && square[7] == '7')

square[7] = mark;
else if (choice == 8 && square[8] == '8')

square[8] = mark;
else if (choice == 9 && square[9] == '9')

square[9] = mark;
else
{
cout << "Invalid move ";

player--;
cin.ignore();
cin.get();
}
i = checkwin();

player++;
} while (i == -1);
board();
if (i == 1)

cout << "==>\aPlayer " << --player << " win ";
else
cout << "==>\aGame draw";

cin.ignore();
cin.get();
return 0;
}

/*********************************************

FUNCTION TO RETURN GAME STATUS
1 FOR GAME IS OVER WITH RESULT
-1 FOR GAME IS IN PROGRESS
O GAME IS OVER AND NO RESULT
**********************************************/

int checkwin()
{
if (square[1] == square[2] && square[2] == square[3])

return 1;
else if (square[4] == square[5] && square[5] == square[6])

return 1;
else if (square[7] == square[8] && square[8] == square[9])

return 1;
else if (square[1] == square[4] && square[4] == square[7])

return 1;
else if (square[2] == square[5] && square[5] == square[8])

return 1;
else if (square[3] == square[6] && square[6] == square[9])

return 1;
else if (square[1] == square[5] && square[5] == square[9])

return 1;
else if (square[3] == square[5] && square[5] == square[7])

return 1;
else if (square[1] != '1' && square[2] != '2' && square[3] != '3'
&& square[4] != '4' && square[5] != '5' && square[6] != '6'
&& square[7] != '7' && square[8] != '8' && square[9] != '9')

return 0;
else
return -1;
}


/*******************************************************************
FUNCTION TO DRAW BOARD OF TIC TAC TOE WITH PLAYERS MARK
********************************************************************/


void board()
{
system("cls");
cout << "\n\n\tTic Tac Toe\n\n";

cout << "Player 1 (X) - Player 2 (O)" << endl << endl;
cout << endl;

cout << " | | " << endl;
cout << " " << square[1] << " | " << square[2] << " | " << square[3] << endl;

cout << "_____|_____|_____" << endl;
cout << " | | " << endl;

cout << " " << square[4] << " | " << square[5] << " | " << square[6] << endl;

cout << "_____|_____|_____" << endl;
cout << " | | " << endl;

cout << " " << square[7] << " | " << square[8] << " | " << square[9] << endl;

cout << " | | " << endl << endl;
}
95 changes: 95 additions & 0 deletions Lab_03/Lab_03/Lab_03.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.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>{5AEED483-6248-4FE6-A1CA-AB383BBBF620}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Lab_03</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</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 Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Lab_03.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
36 changes: 36 additions & 0 deletions Lab_03/Lab_03/Lab_03.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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;hh;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>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Lab_03.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
40 changes: 40 additions & 0 deletions Lab_03/Lab_03/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
========================================================================
CONSOLE APPLICATION : Lab_03 Project Overview
========================================================================

AppWizard has created this Lab_03 application for you.

This file contains a summary of what you will find in each of the files that
make up your Lab_03 application.


Lab_03.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.

Lab_03.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
"Source Files" filter).

Lab_03.cpp
This is the main application source file.

/////////////////////////////////////////////////////////////////////////////
Other standard files:

StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named Lab_03.pch and a precompiled types file named StdAfx.obj.

/////////////////////////////////////////////////////////////////////////////
Other notes:

AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.

/////////////////////////////////////////////////////////////////////////////
8 changes: 8 additions & 0 deletions Lab_03/Lab_03/stdafx.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// Lab_03.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
Loading