1 parent
146fb788a6
commit
eb1cdc34a3
13 files changed
+230
-18
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -19,7 +19,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
|
||||
@@ -1,39 +1,60 @@
|
||||
/******************************************************************************
|
||||
* Program: COM 390 - Project 1
|
||||
* Author: Amrit Panesar <apanesar-77260@student.coleman.edu
|
||||
* Date: 2015-08-11
|
||||
* Purpose: Prompt the user for their name, display the fact that they enjoy
|
||||
* programming in C, and state that it is indeed a piece of cake.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <string.h>
|
||||
|
||||
const char* HELLO ="I love Porgramming in C\n";
|
||||
const char* TOKENS = " ";
|
||||
const int TOKENINDEX = 1; // insert name after token 0
|
||||
const char* CAKE = " \xdc\n \xdb\n \xdc\xdc \xdc\xdf\n \xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdc \xdc\xdc\xdc\xdc\xdc\xdc\xdb\xdb\xdb\xdf\xdb\n \xdc\xdb \xdb\xdb\xdb\xdb\xdb\xdb\xdb \xdb\xdb\xdf\xdf\xdf \xdc\xdc\xdb\xdf\xdb\xdc\xdb\xdb\xdb\n \xdb\xdf\xdf\xdf \xdb\xdb\xdb\xdb\xdb\xdf\xdf\xdc\xdb\xdf\xdc\xdc\xdf\xdf\xdc\xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdb\n \xdb\xdf\xdc\xdc\xdc\xdc\xdb\xdb\xdb \xdc\xdc\xdb\xdf\xdf\xdc\xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdf\xdf\xdc\xdc\n \xdb \xdf\xdf\xdf\xdf\xdf\xdf\xdc\xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdf\xdf\xdc\xdc\xdb\xdb\xdb\xdb\n \xdb \xdb\xdb\xdb\xdb\xdb\xdf\xdf\xdf\xdc\xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdf\n \xdb \xdb\xdf\xdf \xdc\xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdf\xdb\xdc\xdc\xdb\n \xdb \xdc\xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdf\xdb\xdc\xdb\xdb\xdb\xdb\xdb\xdb\n \xdb \xdb\xdb\xdb\xdb\xdf\xdf\xdc\xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdf\xdf\n \xdb \xdf\xdf\xdc\xdc\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdf\xdf\n \xdb \xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdf\xdf\n \xdf\xdc\xdc\xdc \xdb\xdb\xdb\xdf\xdf\n \xdf\xdf\xdf\xdf\xdf\xdf";
|
||||
|
||||
const char* HELLO ="I love Programming in C\n";
|
||||
|
||||
const char* TOKENS = " ";
|
||||
|
||||
const int TOKENINDEX = 1; // insert name after token 0
|
||||
|
||||
char name[256], out[256];
|
||||
char* token, nextToken = NULL;
|
||||
char *token, *nextToken = NULL;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int i = 0;
|
||||
|
||||
printf("%s\n:", "Please enter your name");
|
||||
gets_s(name, sizeof(name));
|
||||
|
||||
strcpy(out, HELLO);
|
||||
// lets begin
|
||||
|
||||
token = strtok_s(out, TOKENS, &nextToken);
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
for (int i = 0; token != NULL; i++) {
|
||||
printf("%s\n:", "Please enter your name"); // prompt for name
|
||||
gets_s(name, sizeof(name)); // set the string into the buffer
|
||||
printf("\n\n"); // new lines
|
||||
|
||||
strcpy(out, HELLO); // copy the string to be tokenized into a mutable buffer
|
||||
|
||||
token = strtok(out, TOKENS); // start the tokenizer
|
||||
|
||||
for (i = 0; token != NULL; i++) // time to loop over the tokens
|
||||
{
|
||||
if (i == TOKENINDEX) {
|
||||
printf(", %s,", name);
|
||||
printf(", %s,", name); // insert after the token index
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
printf("%s", token);
|
||||
printf("%s", token); // token 0 does not get a space (anticipation for name/token 1)
|
||||
} else {
|
||||
printf(" %s", token);
|
||||
printf(" %s", token); // display a space followed by the token data
|
||||
}
|
||||
|
||||
token = strtok_s(NULL, TOKENS, &nextToken);
|
||||
token = strtok(NULL, TOKENS); // delta next token
|
||||
}
|
||||
|
||||
printf("\n%s\n", "Press any key to continue. . .");
|
||||
_getch();
|
||||
printf("\n\n%s\n%s\n", "It's a piece of cake!", CAKE); // cake
|
||||
|
||||
return 0;
|
||||
printf("\n%s\n", "Press any key to continue. . .");
|
||||
getch(); // pause
|
||||
|
||||
return 0; // done!
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project2", "Project2\Project2.vcxproj", "{AA5F6F52-3BEB-4457-ABA0-A005715CE47F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AA5F6F52-3BEB-4457-ABA0-A005715CE47F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AA5F6F52-3BEB-4457-ABA0-A005715CE47F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AA5F6F52-3BEB-4457-ABA0-A005715CE47F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AA5F6F52-3BEB-4457-ABA0-A005715CE47F}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,75 @@
|
||||
<?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>{AA5F6F52-3BEB-4457-ABA0-A005715CE47F}</ProjectGuid>
|
||||
<RootNamespace>Project2</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<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>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</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>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="main.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="main.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,49 @@
|
||||
/******************************************************************************
|
||||
* Program: COM 390 - Project 2
|
||||
* Author: Amrit Panesar <apanesar-77260@student.coleman.edu
|
||||
* Date: 2015-08-11
|
||||
* Purpose: Count from 100 to 0 and 0 to 100 two different ways.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "main.h"
|
||||
|
||||
int i, j, k = 0;
|
||||
char bufnum[3];
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
if (hundred2zero() != TRUE) {
|
||||
printf("Error condition found, exiting early");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (zero2hundred() != TRUE) {
|
||||
printf("Error condition found, exiting early");
|
||||
return 1;
|
||||
}
|
||||
|
||||
pause();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool hundred2zero() {
|
||||
for (i = 1; i <= 100; i++) {
|
||||
sprintf("%d03", i);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool zero2hundred() {
|
||||
j = 100;
|
||||
|
||||
while (j > 0) {
|
||||
sprintf("%d03", j);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void pause() {
|
||||
printf("Press any key to continue. . .");
|
||||
getch();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/******************************************************************************
|
||||
* Program: COM 390 - Project 2
|
||||
* Author: Amrit Panesar <apanesar-77260@student.coleman.edu
|
||||
* Date: 2015-08-11
|
||||
* Purpose: Count from 100 to 0 and 0 to 100 two different ways.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef int bool;
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
bool zero2hundred();
|
||||
bool hundred2zero();
|
||||
|
||||
void pause();
|
||||
Binary file not shown.
Reference in new issue
Block a user