From a065dd231dd4ab923aa7e7693b6343ec46f7768d Mon Sep 17 00:00:00 2001 From: John Welch Date: Wed, 17 Feb 2021 23:59:44 +0000 Subject: [PATCH] Sine Wave in C# --- 78 Sine Wave/csharp/SineWave/SineWave.sln | 25 +++++++++++++++++++ .../csharp/SineWave/SineWave/Program.cs | 15 +++++++++++ .../csharp/SineWave/SineWave/SineWave.csproj | 8 ++++++ 3 files changed, 48 insertions(+) create mode 100644 78 Sine Wave/csharp/SineWave/SineWave.sln create mode 100644 78 Sine Wave/csharp/SineWave/SineWave/Program.cs create mode 100644 78 Sine Wave/csharp/SineWave/SineWave/SineWave.csproj diff --git a/78 Sine Wave/csharp/SineWave/SineWave.sln b/78 Sine Wave/csharp/SineWave/SineWave.sln new file mode 100644 index 00000000..f32a06cd --- /dev/null +++ b/78 Sine Wave/csharp/SineWave/SineWave.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31005.135 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SineWave", "SineWave\SineWave.csproj", "{B316DD7F-5755-4216-AFDC-D83720F8ACA2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B316DD7F-5755-4216-AFDC-D83720F8ACA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B316DD7F-5755-4216-AFDC-D83720F8ACA2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B316DD7F-5755-4216-AFDC-D83720F8ACA2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B316DD7F-5755-4216-AFDC-D83720F8ACA2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {32A37343-2955-4124-8765-9143F6C529DC} + EndGlobalSection +EndGlobal diff --git a/78 Sine Wave/csharp/SineWave/SineWave/Program.cs b/78 Sine Wave/csharp/SineWave/SineWave/Program.cs new file mode 100644 index 00000000..6f44f8d5 --- /dev/null +++ b/78 Sine Wave/csharp/SineWave/SineWave/Program.cs @@ -0,0 +1,15 @@ +using System; + +Console.WriteLine(Tab(30) + "Sine Wave"); +Console.WriteLine(Tab(15) + "Creative Computing Morristown, New Jersey\n\n\n\n\n"); + +bool isCreative = true; +for (double t = 0.0; t <= 40.0; t += 0.25) +{ + int a = (int)(26 + 25 * Math.Sin(t)); + string word = isCreative ? "Creative" : "Computing"; + Console.WriteLine($"{Tab(a)}{word}"); + isCreative = !isCreative; +} + +static string Tab(int n) => new string(' ', n); \ No newline at end of file diff --git a/78 Sine Wave/csharp/SineWave/SineWave/SineWave.csproj b/78 Sine Wave/csharp/SineWave/SineWave/SineWave.csproj new file mode 100644 index 00000000..20827042 --- /dev/null +++ b/78 Sine Wave/csharp/SineWave/SineWave/SineWave.csproj @@ -0,0 +1,8 @@ + + + + Exe + net5.0 + + +