Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions HelloWorld/HelloWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ static void Main(string[] args)
Console.Write(yourName);
}
}

}
28 changes: 28 additions & 0 deletions PigLatin/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/PigLatin.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
,]
}
15 changes: 15 additions & 0 deletions PigLatin/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/PigLatin.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
29 changes: 24 additions & 5 deletions PigLatin/PigLatin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,34 @@ class Program
public static void Main()
{
// your code goes here
System.Console.WriteLine("enter the phrase you want to translate:");
string input = Console.ReadLine().ToLower();
string output = "";
char[] punctuation = new char[] { ',', '?', '"' };

// leave this command at the end so your program does not close automatically
Console.ReadLine();
string[] words = input.Split(' ');
foreach (var item in words)
{
output += TranslateWord(item) + " ";
}
Console.WriteLine(output);
}

public static string TranslateWord(string word)


public static string TranslateWord(string input)
{
// your code goes here
return word;
char[] vowels = new char[] { 'a', 'e', 'i', 'o', 'u' };

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are missing a vowel here... Try running your program with the word my.

int firstLetterIndex = input.IndexOfAny(vowels);
string firstPart = input.Substring(0, firstLetterIndex);
string restWord = input.Substring(firstLetterIndex);
input = restWord + firstPart + "ay";

if (firstLetterIndex == 0)
{
input = restWord + "yay";
}
return input;
}
}
}
23 changes: 23 additions & 0 deletions Practice/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;

namespace practice
{
class Program
{
static void Main(string[] args)
{
string firstWord = "simple ";
string secondWord = "word";

string firstLetter = firstWord.Substring(0,1);
string restWord = firstWord.Substring(1,5);

string secondFirstLetter = secondWord.Substring(0,1);
string secondRestWord = secondWord.Substring(1,3);

Console.WriteLine(restWord + firstLetter + "ay");
Console.WriteLine(secondRestWord + secondFirstLetter + "ay");

}
}
}
8 changes: 8 additions & 0 deletions Practice/practice.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>

</Project>