Last active
April 26, 2023 00:22
-
-
Save sammysheep/8ccd8a8d28373635b6d073b53bc4535a to your computer and use it in GitHub Desktop.
SmithClass-VowelCount
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Vowel Count - returns the number of vowels in a document from the command line | |
string filename = ""; | |
if (args.Length != 1) | |
{ | |
Console.WriteLine($"\nUsage:\n\tdotnet run <filename>\n"); | |
System.Environment.Exit(1); | |
} | |
else | |
{ | |
filename = args[0]; | |
if (!File.Exists(filename)) | |
{ | |
Console.WriteLine($"No file found named '{filename}'"); | |
System.Environment.Exit(1); | |
} | |
} | |
var data = File.ReadAllText(filename); | |
// count | |
foreach (YOUR VARIABLE DECLARED HERE in data.ToLower()) | |
{ | |
// Do something to count vowels | |
} | |
Console.WriteLine($"The number of vowels in {filename} is: {count}"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment