Question: More while Loops: In this lab, you will get more practice using while Loops. Example Program: EOF - controlled while loops are a special case
More while Loops:
In this lab, you will get more practice using while Loops.
Example Program:
EOFcontrolled while loops are a special case of flagcontrolled while loops. When we are reading from a
file and the end of the file is reached, a special case flag is set to true. For StreamReader, this is
EndOfStream.
The example program for EOFcontrolled while loops reads a series of numbers from an input file and
finds the average of those numbers. Download EOFAverage.cs and create a project for it in Visual C#
Read and understand the code and run the program.
Your Program:
For your program you will search a dictionary file for the word provided by the user. First ask the user to input a word. Search the dictionary file for that word and tell the user whether or not the word was
found. This program demonstrates a linear search technique. When you perform a linear search, you start at the beginning of a list and search through the list in order until you reach the desired item or the end of the list. You may need to make use of a break statement to exit the loop early if you find a match. Linear
search is a very inefficient method, and we will learn about better search techniques later. Here is a dictionary file for Windows that you can use. You must either put your dictionary file in your
Visual C# project folder, or specify the path to the dictionary file in your program. Your output should look similar to the following figure. Turn in your completed program.
Challenge:
For the challenge component this week, modify your program through the use of the toLower string
function so that capital or lowercase spelling by the user doesnt affect the program. Hello or hello
should both return a positive answer in the normal program, Hello will not, because the capital H
wont match
Additionally, rewrite the program to make use of a dowhile loop, instead of a while loop. Submit both
forms while for the basic lab, and dowhile for the challenge
If you can be specific on the c# code and detailed with linear search. If you can also be detailed on how to attach txt file so the program opens the file. If the code can show the sample output.
Sample Output:
fileC:UserssilcoxDocumentsVisual Studio ProjectsDemoProjectDemoProjectb
Please enter a word; hells
That is a real mord?!
Preeses any key to continue...
I. fileC:UserssilcaxDocumentsVisual Studio ProjectsDemoProjectDemoProjectb
Please enter a uord: adhh
Oh that isn't a real mord...
Preasan any lery to continue...
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
