diff --git a/COM390/Lab2/Lab2.sln b/COM390/Lab2/Lab2.sln new file mode 100644 index 0000000..543dfa5 --- /dev/null +++ b/COM390/Lab2/Lab2.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lab2", "Lab2\Lab2.vcxproj", "{31BF97FC-4530-46FE-8320-370670099068}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {31BF97FC-4530-46FE-8320-370670099068}.Debug|Win32.ActiveCfg = Debug|Win32 + {31BF97FC-4530-46FE-8320-370670099068}.Debug|Win32.Build.0 = Debug|Win32 + {31BF97FC-4530-46FE-8320-370670099068}.Release|Win32.ActiveCfg = Release|Win32 + {31BF97FC-4530-46FE-8320-370670099068}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/COM390/Lab2/Lab2/Lab2.c b/COM390/Lab2/Lab2/Lab2.c new file mode 100644 index 0000000..9f89b50 --- /dev/null +++ b/COM390/Lab2/Lab2/Lab2.c @@ -0,0 +1,51 @@ +// Lab2.cpp : Defines the entry point for the console application. +// + +#include "Lab2.h" + +#include +#include +#include +#include +#include + +my_basic_structure_1 *pArray[LGBUFSIZE]; +my_basic_structure_1 *pArray2[REGBUFSIZE]; +my_basic_structure_1 *mbsPtr; +my_basic_structure_1 *mbsPtr2; + +int i, j, k = 0; + +void init() { + for (i = 0; i < LGBUFSIZE; i++) { + pArray[i] = (my_basic_structure_1*)malloc(sizeof(my_basic_structure_1)); + memset(pArray[i], '\0', sizeof(my_basic_structure_1)); + } + mbsPtr = (my_basic_structure_1*) malloc(sizeof(my_basic_structure_1) * REGBUFSIZE); + mbsPtr2 = mbsPtr; + for (i = 0; i < REGBUFSIZE; i++) { + memset(mbsPtr2, '\0', sizeof(my_basic_structure_1)); + mbsPtr2++; + } +} + +int main(int argc, char **argv) +{ + init(); + + pause(); + + cleanup(); + return 0; +} + +void cleanup() { + for (i = 0; i < LGBUFSIZE; i++) { + free(pArray[i]); + } +} + +void pause() { + printf("\n%s\n", "Press any key to continue. . . "); + getch(); +} \ No newline at end of file diff --git a/COM390/Lab2/Lab2/Lab2.h b/COM390/Lab2/Lab2/Lab2.h new file mode 100644 index 0000000..192324f --- /dev/null +++ b/COM390/Lab2/Lab2/Lab2.h @@ -0,0 +1,18 @@ +// Header file + +#define LGBUFSIZE 1024 +#define REGBUFSIZE 256 +#define SMBUFSIZE 64 + +typedef struct { + + int a; + int b; + char buff[SMBUFSIZE]; + +}my_basic_structure_1; + + +void init(); +void cleanup(); +void pause(); diff --git a/COM390/Lab2/Lab2/Lab2.vcxproj b/COM390/Lab2/Lab2/Lab2.vcxproj new file mode 100644 index 0000000..caf0f13 --- /dev/null +++ b/COM390/Lab2/Lab2/Lab2.vcxproj @@ -0,0 +1,90 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {31BF97FC-4530-46FE-8320-370670099068} + Win32Proj + Lab2 + + + + Application + true + v110 + Unicode + + + Application + false + v110 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/COM390/Lab2/Lab2/Lab2.vcxproj.filters b/COM390/Lab2/Lab2/Lab2.vcxproj.filters new file mode 100644 index 0000000..717f9ae --- /dev/null +++ b/COM390/Lab2/Lab2/Lab2.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;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 + + + + + Source Files + + + \ No newline at end of file diff --git a/COM390/Lab2/Lab2/ReadMe.txt b/COM390/Lab2/Lab2/ReadMe.txt new file mode 100644 index 0000000..e7b93c7 --- /dev/null +++ b/COM390/Lab2/Lab2/ReadMe.txt @@ -0,0 +1,40 @@ +======================================================================== + CONSOLE APPLICATION : Lab2 Project Overview +======================================================================== + +AppWizard has created this Lab2 application for you. + +This file contains a summary of what you will find in each of the files that +make up your Lab2 application. + + +Lab2.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. + +Lab2.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). + +Lab2.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 Lab2.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/COM390/Lab2/Lab2/targetver.h b/COM390/Lab2/Lab2/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/COM390/Lab2/Lab2/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/COM390/Project3/CoverSheet.docx b/COM390/Project3/CoverSheet.docx new file mode 100644 index 0000000..1f4d38d Binary files /dev/null and b/COM390/Project3/CoverSheet.docx differ diff --git a/COM390/Project3/Project3.pdf b/COM390/Project3/Project3.pdf new file mode 100644 index 0000000..509e285 Binary files /dev/null and b/COM390/Project3/Project3.pdf differ diff --git a/COM390/Project3/Project3/main.c b/COM390/Project3/Project3/main.c index ff6f08d..1c67adf 100644 --- a/COM390/Project3/Project3/main.c +++ b/COM390/Project3/Project3/main.c @@ -1,8 +1,62 @@ +/****************************************************************************** + * Author: Amrit Panesar + * Project: 3 - Special Characters + * Date: 09/25/2015 + * Purpose: Sanitize a random string to only allow a-zA-Z0-9 without regex + *****************************************************************************/ + #include #include #include +#define FILTERPAIRS 5 +#define PAIR 2 + +char filter[FILTERPAIRS][PAIR]; +char *Buffer; + +const char * RandomStr = "sdjsn9i3ms;sa;'smsn92;w;''[w0p4;dsmsdf"; + +int i, j, k = 0; + +void init() { + filter[0][0] = 0; // control characters + filter[0][1] = 31; + + filter[1][0] = 32; // puncutation + filter[1][1] = 47; + + filter[2][0] = 58; // puncutation + filter[2][1] = 64; + + filter[3][0] = 91; // + filter[3][1] = 96; + + filter[4][0] = 123; + filter[4][1] = 255; +} + +void shutdown() { + printf("\n%s\n", "Press any key to continue. . . "); + getch(); +} int main (int argc, char** argv) { + init(); + Buffer = strdup(RandomStr); + + printf("%s:\n\n\t%s\n", "Start", Buffer); + + for (i = 0; i < FILTERPAIRS; i++) { + for (j = 0; j < strlen(Buffer); j++) { + if (Buffer[j] >= filter[i][0] && Buffer[j] <= filter[i][1]) { + Buffer[j] = ' '; + } + } + } + + printf("%s:\n\n\t%s\n", "Result", Buffer); + + shutdown(); } \ No newline at end of file diff --git a/COM390/Project3/Screenshots.docx b/COM390/Project3/Screenshots.docx new file mode 100644 index 0000000..3a0b929 Binary files /dev/null and b/COM390/Project3/Screenshots.docx differ diff --git a/COM390/Project4/Project4.sln b/COM390/Project4/Project4.sln new file mode 100644 index 0000000..e1be5a0 --- /dev/null +++ b/COM390/Project4/Project4.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project4", "Project4\Project4.vcxproj", "{B2B426C6-4748-4305-A246-1F765B5CF88D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B2B426C6-4748-4305-A246-1F765B5CF88D}.Debug|Win32.ActiveCfg = Debug|Win32 + {B2B426C6-4748-4305-A246-1F765B5CF88D}.Debug|Win32.Build.0 = Debug|Win32 + {B2B426C6-4748-4305-A246-1F765B5CF88D}.Release|Win32.ActiveCfg = Release|Win32 + {B2B426C6-4748-4305-A246-1F765B5CF88D}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/COM390/Project4/Project4/Helper.c b/COM390/Project4/Project4/Helper.c new file mode 100644 index 0000000..1a672d1 --- /dev/null +++ b/COM390/Project4/Project4/Helper.c @@ -0,0 +1,45 @@ +#include "Project4.h" + +#include + +void pause() { + printf("\n%s\n", "Press any key to continue. . ."); + getch(); +} + +void clrscr() + { + HANDLE hStdOut; + CONSOLE_SCREEN_BUFFER_INFO csbi; + DWORD count; + DWORD cellCount; + COORD homeCoords = { 0, 0 }; + + hStdOut = GetStdHandle( STD_OUTPUT_HANDLE ); + if (hStdOut == INVALID_HANDLE_VALUE) return; + + /* Get the number of cells in the current buffer */ + if (!GetConsoleScreenBufferInfo( hStdOut, &csbi )) return; + cellCount = csbi.dwSize.X *csbi.dwSize.Y; + + /* Fill the entire buffer with spaces */ + if (!FillConsoleOutputCharacter( + hStdOut, + (TCHAR) ' ', + cellCount, + homeCoords, + &count + )) return; + + /* Fill the entire buffer with the current colors and attributes */ + if (!FillConsoleOutputAttribute( + hStdOut, + csbi.wAttributes, + cellCount, + homeCoords, + &count + )) return; + + /* Move the cursor home */ + SetConsoleCursorPosition( hStdOut, homeCoords ); + } \ No newline at end of file diff --git a/COM390/Project4/Project4/Project4.c b/COM390/Project4/Project4/Project4.c new file mode 100644 index 0000000..0c2aa16 --- /dev/null +++ b/COM390/Project4/Project4/Project4.c @@ -0,0 +1,41 @@ +// Project4.cpp : Defines the entry point for the console application. +// + +#include "Project4.h" + +#define holdsize 5 + +TtimeStruct holding[holdsize]; + +int i, j ,k = 0; + +void init() { + for (i = 0; i < holdsize; i++) { + holding[i] = (TtimeStruct)malloc(sizeof(TravTimeStruct)); + } +} + +void getInputs() { + for (i = 0; i < holdsize; i++) { + clrscr(); + printf("%s%d\n\n", "Input for #", i); + printf("%s\n:", "Please enter a speed"); + } +} + +int main(int argc, char **argv) { + init(); + + getInputs(); + + pause(); + + down(); + return 0; +} + +void down() { + for (i = 0; i < holdsize; i++) { + free(holding[i]); + } +} diff --git a/COM390/Project4/Project4/Project4.h b/COM390/Project4/Project4/Project4.h new file mode 100644 index 0000000..02469c2 --- /dev/null +++ b/COM390/Project4/Project4/Project4.h @@ -0,0 +1,22 @@ + +#include +#include +#include +#include +#include + +#define true 1; +#define false 0; + +typedef struct +{ + float speed; + float distance; + float timetraveled; +} TravTimeStruct, *TtimeStruct; + + +void init(); +void down(); +void pause(); +void clrscr(); \ No newline at end of file diff --git a/COM390/Project4/Project4/Project4.vcxproj b/COM390/Project4/Project4/Project4.vcxproj new file mode 100644 index 0000000..77833e0 --- /dev/null +++ b/COM390/Project4/Project4/Project4.vcxproj @@ -0,0 +1,91 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {B2B426C6-4748-4305-A246-1F765B5CF88D} + Win32Proj + Project4 + + + + Application + true + v110 + Unicode + + + Application + false + v110 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/COM390/Project4/Project4/Project4.vcxproj.filters b/COM390/Project4/Project4/Project4.vcxproj.filters new file mode 100644 index 0000000..db3b401 --- /dev/null +++ b/COM390/Project4/Project4/Project4.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;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 + + + + + Source Files + + + \ No newline at end of file diff --git a/COM390/Project4/Project4/ReadMe.txt b/COM390/Project4/Project4/ReadMe.txt new file mode 100644 index 0000000..2aa8127 --- /dev/null +++ b/COM390/Project4/Project4/ReadMe.txt @@ -0,0 +1,40 @@ +======================================================================== + CONSOLE APPLICATION : Project4 Project Overview +======================================================================== + +AppWizard has created this Project4 application for you. + +This file contains a summary of what you will find in each of the files that +make up your Project4 application. + + +Project4.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. + +Project4.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). + +Project4.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 Project4.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/SDrive/Templates/CoverSheet.dotx b/SDrive/Templates/CoverSheet.dotx index cee64b0..01d2e63 100644 Binary files a/SDrive/Templates/CoverSheet.dotx and b/SDrive/Templates/CoverSheet.dotx differ