diff --git a/Lab_03/Debug/Lab_03.exe b/Lab_03/Debug/Lab_03.exe new file mode 100644 index 0000000..5234ffa Binary files /dev/null and b/Lab_03/Debug/Lab_03.exe differ diff --git a/Lab_03/Debug/Lab_03.ilk b/Lab_03/Debug/Lab_03.ilk new file mode 100644 index 0000000..2d791d9 Binary files /dev/null and b/Lab_03/Debug/Lab_03.ilk differ diff --git a/Lab_03/Debug/Lab_03.pdb b/Lab_03/Debug/Lab_03.pdb new file mode 100644 index 0000000..817f87c Binary files /dev/null and b/Lab_03/Debug/Lab_03.pdb differ diff --git a/Lab_03/Lab_03.sdf b/Lab_03/Lab_03.sdf new file mode 100644 index 0000000..862a81f Binary files /dev/null and b/Lab_03/Lab_03.sdf differ diff --git a/Lab_03/Lab_03.sln b/Lab_03/Lab_03.sln new file mode 100644 index 0000000..2f28831 --- /dev/null +++ b/Lab_03/Lab_03.sln @@ -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 diff --git a/Lab_03/Lab_03.v12.suo b/Lab_03/Lab_03.v12.suo new file mode 100644 index 0000000..14002a3 Binary files /dev/null and b/Lab_03/Lab_03.v12.suo differ diff --git a/Lab_03/Lab_03/Debug/Lab_03.Build.CppClean.log b/Lab_03/Lab_03/Debug/Lab_03.Build.CppClean.log new file mode 100644 index 0000000..600f13d --- /dev/null +++ b/Lab_03/Lab_03/Debug/Lab_03.Build.CppClean.log @@ -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 diff --git a/Lab_03/Lab_03/Debug/Lab_03.log b/Lab_03/Lab_03/Debug/Lab_03.log new file mode 100644 index 0000000..a94d686 --- /dev/null +++ b/Lab_03/Lab_03/Debug/Lab_03.log @@ -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 diff --git a/Lab_03/Lab_03/Debug/Lab_03.obj b/Lab_03/Lab_03/Debug/Lab_03.obj new file mode 100644 index 0000000..7ff3803 Binary files /dev/null and b/Lab_03/Lab_03/Debug/Lab_03.obj differ diff --git a/Lab_03/Lab_03/Debug/Lab_03.pch b/Lab_03/Lab_03/Debug/Lab_03.pch new file mode 100644 index 0000000..be00f7e Binary files /dev/null and b/Lab_03/Lab_03/Debug/Lab_03.pch differ diff --git a/Lab_03/Lab_03/Debug/Lab_03.tlog/CL.read.1.tlog b/Lab_03/Lab_03/Debug/Lab_03.tlog/CL.read.1.tlog new file mode 100644 index 0000000..b88d17b Binary files /dev/null and b/Lab_03/Lab_03/Debug/Lab_03.tlog/CL.read.1.tlog differ diff --git a/Lab_03/Lab_03/Debug/Lab_03.tlog/CL.write.1.tlog b/Lab_03/Lab_03/Debug/Lab_03.tlog/CL.write.1.tlog new file mode 100644 index 0000000..17f6c2d Binary files /dev/null and b/Lab_03/Lab_03/Debug/Lab_03.tlog/CL.write.1.tlog differ diff --git a/Lab_03/Lab_03/Debug/Lab_03.tlog/Lab_03.lastbuildstate b/Lab_03/Lab_03/Debug/Lab_03.tlog/Lab_03.lastbuildstate new file mode 100644 index 0000000..b7bf9d5 --- /dev/null +++ b/Lab_03/Lab_03/Debug/Lab_03.tlog/Lab_03.lastbuildstate @@ -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\| diff --git a/Lab_03/Lab_03/Debug/Lab_03.tlog/cl.command.1.tlog b/Lab_03/Lab_03/Debug/Lab_03.tlog/cl.command.1.tlog new file mode 100644 index 0000000..b332484 Binary files /dev/null and b/Lab_03/Lab_03/Debug/Lab_03.tlog/cl.command.1.tlog differ diff --git a/Lab_03/Lab_03/Debug/Lab_03.tlog/link.command.1.tlog b/Lab_03/Lab_03/Debug/Lab_03.tlog/link.command.1.tlog new file mode 100644 index 0000000..ce1fb3c Binary files /dev/null and b/Lab_03/Lab_03/Debug/Lab_03.tlog/link.command.1.tlog differ diff --git a/Lab_03/Lab_03/Debug/Lab_03.tlog/link.read.1.tlog b/Lab_03/Lab_03/Debug/Lab_03.tlog/link.read.1.tlog new file mode 100644 index 0000000..504809d Binary files /dev/null and b/Lab_03/Lab_03/Debug/Lab_03.tlog/link.read.1.tlog differ diff --git a/Lab_03/Lab_03/Debug/Lab_03.tlog/link.write.1.tlog b/Lab_03/Lab_03/Debug/Lab_03.tlog/link.write.1.tlog new file mode 100644 index 0000000..66eb95d Binary files /dev/null and b/Lab_03/Lab_03/Debug/Lab_03.tlog/link.write.1.tlog differ diff --git a/Lab_03/Lab_03/Debug/stdafx.obj b/Lab_03/Lab_03/Debug/stdafx.obj new file mode 100644 index 0000000..392bc9e Binary files /dev/null and b/Lab_03/Lab_03/Debug/stdafx.obj differ diff --git a/Lab_03/Lab_03/Debug/vc120.idb b/Lab_03/Lab_03/Debug/vc120.idb new file mode 100644 index 0000000..79e957e Binary files /dev/null and b/Lab_03/Lab_03/Debug/vc120.idb differ diff --git a/Lab_03/Lab_03/Debug/vc120.pdb b/Lab_03/Lab_03/Debug/vc120.pdb new file mode 100644 index 0000000..76c6e24 Binary files /dev/null and b/Lab_03/Lab_03/Debug/vc120.pdb differ diff --git a/Lab_03/Lab_03/Lab_03.cpp b/Lab_03/Lab_03/Lab_03.cpp new file mode 100644 index 0000000..d2acc18 --- /dev/null +++ b/Lab_03/Lab_03/Lab_03.cpp @@ -0,0 +1,152 @@ +// Lab_03.cpp : Defines the entry point for the console application. +// + + +#include "stdafx.h" +#include +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; +} \ No newline at end of file diff --git a/Lab_03/Lab_03/Lab_03.vcxproj b/Lab_03/Lab_03/Lab_03.vcxproj new file mode 100644 index 0000000..4caf2eb --- /dev/null +++ b/Lab_03/Lab_03/Lab_03.vcxproj @@ -0,0 +1,95 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {5AEED483-6248-4FE6-A1CA-AB383BBBF620} + Win32Proj + Lab_03 + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + Create + Create + + + + + + \ No newline at end of file diff --git a/Lab_03/Lab_03/Lab_03.vcxproj.filters b/Lab_03/Lab_03/Lab_03.vcxproj.filters new file mode 100644 index 0000000..9147de8 --- /dev/null +++ b/Lab_03/Lab_03/Lab_03.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/Lab_03/Lab_03/ReadMe.txt b/Lab_03/Lab_03/ReadMe.txt new file mode 100644 index 0000000..ae59e1d --- /dev/null +++ b/Lab_03/Lab_03/ReadMe.txt @@ -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. + +///////////////////////////////////////////////////////////////////////////// diff --git a/Lab_03/Lab_03/stdafx.cpp b/Lab_03/Lab_03/stdafx.cpp new file mode 100644 index 0000000..b42dbeb --- /dev/null +++ b/Lab_03/Lab_03/stdafx.cpp @@ -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 diff --git a/Lab_03/Lab_03/stdafx.h b/Lab_03/Lab_03/stdafx.h new file mode 100644 index 0000000..b005a83 --- /dev/null +++ b/Lab_03/Lab_03/stdafx.h @@ -0,0 +1,15 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include +#include + + + +// TODO: reference additional headers your program requires here diff --git a/Lab_03/Lab_03/targetver.h b/Lab_03/Lab_03/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/Lab_03/Lab_03/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/Lab_03/ipch/lab_03-d99d0677/lab_03-118bedfd.ipch b/Lab_03/ipch/lab_03-d99d0677/lab_03-118bedfd.ipch new file mode 100644 index 0000000..9262a3f Binary files /dev/null and b/Lab_03/ipch/lab_03-d99d0677/lab_03-118bedfd.ipch differ