diff --git a/ConsoleApplication1/App.config b/ConsoleApplication1/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/ConsoleApplication1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ConsoleApplication1/MissingNumber.csproj b/ConsoleApplication1/MissingNumber.csproj new file mode 100644 index 0000000..a03e9e5 --- /dev/null +++ b/ConsoleApplication1/MissingNumber.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {A5469920-53CE-45DB-B3D7-75D1FF5C73D1} + Exe + Properties + MissingNumber + MissingNumber + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + MissingNumber.Missing + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + + + \ No newline at end of file diff --git a/ConsoleApplication1/Program.cs b/ConsoleApplication1/Program.cs new file mode 100644 index 0000000..6e062a3 --- /dev/null +++ b/ConsoleApplication1/Program.cs @@ -0,0 +1,60 @@ +using System; +using System.IO; +using System.Linq; + +/* Christine Mullins + * 10-26-2015 + */ +namespace MissingNumber +{ + public class Missing + { + static void Main(string[] args) + { + int missing = 0; + string textLine; + + StreamReader file = new StreamReader("inputlines.txt"); + while ((textLine = file.ReadLine()) != null) + { + if (!textLine.Equals(string.Empty)) + { + int[] numbers = cleanLine(textLine); + missing = getMissing(numbers); + System.Console.WriteLine(missing + "\n"); + } + } + + file.Close(); + System.Console.ReadLine(); + } + + public static int[] cleanLine(string textLine) + { + string[] temp = textLine.Split(','); + int[] numLine = temp.Select(x => int.Parse(x)).ToArray(); + Array.Sort(numLine); + + return numLine; + } + + public static int getMissing(int[] nums) + { + int missing = 0; + int dif = 0; + + for (int i = 0; i < nums.Length - 1; i++) + { + dif = nums[i + 1] - nums[i]; + if (dif > 1) + { + missing = nums[i] + 1; + + } + dif = 0; + } + + return missing; + } + } +} \ No newline at end of file diff --git a/ConsoleApplication1/Properties/AssemblyInfo.cs b/ConsoleApplication1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f66e74d --- /dev/null +++ b/ConsoleApplication1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ConsoleApplication1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ConsoleApplication1")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("91b6434a-3323-4b9b-9114-47808bb32244")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ConsoleApplication1/StyleCop.Cache b/ConsoleApplication1/StyleCop.Cache new file mode 100644 index 0000000..4e1d8d4 --- /dev/null +++ b/ConsoleApplication1/StyleCop.Cache @@ -0,0 +1,70 @@ + + 12 + + DEBUG;TRACE + + + + 2014/04/01 10:18:24.000 + 2014/06/13 10:24:25.580 + 2015/10/26 21:58:34.871 + 2014/04/01 10:18:24.000 + 2014/04/01 10:18:24.000 + 1157575881 + 2014/04/01 10:18:24.000 + 0 + 2014/04/01 10:18:24.000 + 0 + 2014/04/01 10:18:24.000 + 0 + 2014/04/01 10:18:24.000 + 0 + 2014/04/01 10:18:24.000 + 0 + 2014/04/01 10:18:24.000 + 0 + + + + The class must have a documentation header. + 10 + False + + + A closing curly bracket must not be preceded by a blank line. + 58 + False + + + The method must have a documentation header. + 12 + False + + + Statements or elements wrapped in curly brackets must be followed by a blank line. + 26 + False + + + The method must have a documentation header. + 31 + False + + + A closing curly bracket must not be preceded by a blank line. + 38 + False + + + The method must have a documentation header. + 40 + False + + + Statements or elements wrapped in curly brackets must be followed by a blank line. + 51 + False + + + + \ No newline at end of file diff --git a/ConsoleApplication1/bin/Debug/ConsoleApplication1.vshost.exe.config b/ConsoleApplication1/bin/Debug/ConsoleApplication1.vshost.exe.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/ConsoleApplication1/bin/Debug/ConsoleApplication1.vshost.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ConsoleApplication1/bin/Debug/MissingNumber.exe b/ConsoleApplication1/bin/Debug/MissingNumber.exe new file mode 100644 index 0000000..19020f4 Binary files /dev/null and b/ConsoleApplication1/bin/Debug/MissingNumber.exe differ diff --git a/ConsoleApplication1/bin/Debug/MissingNumber.exe.config b/ConsoleApplication1/bin/Debug/MissingNumber.exe.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/ConsoleApplication1/bin/Debug/MissingNumber.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ConsoleApplication1/bin/Debug/MissingNumber.pdb b/ConsoleApplication1/bin/Debug/MissingNumber.pdb new file mode 100644 index 0000000..e3d32fc Binary files /dev/null and b/ConsoleApplication1/bin/Debug/MissingNumber.pdb differ diff --git a/ConsoleApplication1/bin/Debug/MissingNumber.vshost.exe b/ConsoleApplication1/bin/Debug/MissingNumber.vshost.exe new file mode 100644 index 0000000..666c0af Binary files /dev/null and b/ConsoleApplication1/bin/Debug/MissingNumber.vshost.exe differ diff --git a/ConsoleApplication1/bin/Debug/MissingNumber.vshost.exe.config b/ConsoleApplication1/bin/Debug/MissingNumber.vshost.exe.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/ConsoleApplication1/bin/Debug/MissingNumber.vshost.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ConsoleApplication1/bin/Debug/inputlines.txt b/ConsoleApplication1/bin/Debug/inputlines.txt new file mode 100644 index 0000000..cdc17e0 --- /dev/null +++ b/ConsoleApplication1/bin/Debug/inputlines.txt @@ -0,0 +1,9 @@ +1,2,3,4,5,6,7,8,9,10,12 + +24,26,27,29,28 + +1,2,4,5 + +99,100,101,102,103,104,105,107 + +109,105,107,108,106,110,112,111,118,116,115,114,117 \ No newline at end of file diff --git a/ConsoleApplication1/inputlines.txt b/ConsoleApplication1/inputlines.txt new file mode 100644 index 0000000..cdc17e0 --- /dev/null +++ b/ConsoleApplication1/inputlines.txt @@ -0,0 +1,9 @@ +1,2,3,4,5,6,7,8,9,10,12 + +24,26,27,29,28 + +1,2,4,5 + +99,100,101,102,103,104,105,107 + +109,105,107,108,106,110,112,111,118,116,115,114,117 \ No newline at end of file diff --git a/ConsoleApplication1/obj/Debug/ConsoleApplication1.csproj.FileListAbsolute.txt b/ConsoleApplication1/obj/Debug/ConsoleApplication1.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..70e27b7 --- /dev/null +++ b/ConsoleApplication1/obj/Debug/ConsoleApplication1.csproj.FileListAbsolute.txt @@ -0,0 +1,6 @@ +c:\users\christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe.config +c:\users\christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe +c:\users\christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.pdb +c:\users\christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.exe +c:\users\christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.pdb +c:\users\christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.csprojResolveAssemblyReference.cache diff --git a/ConsoleApplication1/obj/Debug/ConsoleApplication1.csprojResolveAssemblyReference.cache b/ConsoleApplication1/obj/Debug/ConsoleApplication1.csprojResolveAssemblyReference.cache new file mode 100644 index 0000000..d741192 Binary files /dev/null and b/ConsoleApplication1/obj/Debug/ConsoleApplication1.csprojResolveAssemblyReference.cache differ diff --git a/ConsoleApplication1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/ConsoleApplication1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..4c99405 Binary files /dev/null and b/ConsoleApplication1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/ConsoleApplication1/obj/Debug/MissingNumber.csproj.FileListAbsolute.txt b/ConsoleApplication1/obj/Debug/MissingNumber.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..eb06790 --- /dev/null +++ b/ConsoleApplication1/obj/Debug/MissingNumber.csproj.FileListAbsolute.txt @@ -0,0 +1,6 @@ +C:\Users\Christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\inputlines.txt +C:\Users\Christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\MissingNumber.exe.config +C:\Users\Christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\MissingNumber.exe +C:\Users\Christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\MissingNumber.pdb +C:\Users\Christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\obj\Debug\MissingNumber.exe +C:\Users\Christine\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\obj\Debug\MissingNumber.pdb diff --git a/ConsoleApplication1/obj/Debug/MissingNumber.exe b/ConsoleApplication1/obj/Debug/MissingNumber.exe new file mode 100644 index 0000000..19020f4 Binary files /dev/null and b/ConsoleApplication1/obj/Debug/MissingNumber.exe differ diff --git a/ConsoleApplication1/obj/Debug/MissingNumber.pdb b/ConsoleApplication1/obj/Debug/MissingNumber.pdb new file mode 100644 index 0000000..e3d32fc Binary files /dev/null and b/ConsoleApplication1/obj/Debug/MissingNumber.pdb differ diff --git a/ConsoleApplication1/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/ConsoleApplication1/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs new file mode 100644 index 0000000..e69de29 diff --git a/ConsoleApplication1/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/ConsoleApplication1/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs new file mode 100644 index 0000000..e69de29 diff --git a/ConsoleApplication1/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/ConsoleApplication1/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs new file mode 100644 index 0000000..e69de29 diff --git a/MissingNumber.sln b/MissingNumber.sln new file mode 100644 index 0000000..dfa6c47 --- /dev/null +++ b/MissingNumber.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MissingNumber", "ConsoleApplication1\MissingNumber.csproj", "{A5469920-53CE-45DB-B3D7-75D1FF5C73D1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A5469920-53CE-45DB-B3D7-75D1FF5C73D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5469920-53CE-45DB-B3D7-75D1FF5C73D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5469920-53CE-45DB-B3D7-75D1FF5C73D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5469920-53CE-45DB-B3D7-75D1FF5C73D1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal