I have to create a small program where I have to prompt the user for idioms and store these into a text file. After that, I have to open up the text file and count the number of individual vowels in each idiom (a, e, i, o, u) and display these to the user.
Here is the code I have created so far:
int numberOfIdioms;
string fileName = "idioms.txt";
int countA = 0, countE = 0, countI = 0, countO = 0, countU = 0;
Console.Title = "String Functions";
Console.Write("Please enter number of idioms: ");
numberOfIdioms = int.Parse(Console.ReadLine());
string[] idioms = new string[numberOfIdioms];
Console.WriteLine();
for (int aa = 0; aa < idioms.Length; aa++)
{
Console.Write("Enter idiom {0}: ", aa + 1);
idioms[aa] = Console.ReadLine();
}
StreamWriter myIdiomsFile = new StreamWriter(fileName);
for (int a = 0; a < numberOfIdioms; a++)
{
myIdiomsFile.WriteLine("{0}", idioms[a]);
}
myIdiomsFile.Close();