Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write the code in C#, Visual Studio 1) Create a method: void countHowMany(string str, out int aCount, out int bLastLine, out int aFirstLine). The function
write the code in C#, Visual Studio 1) Create a method: void countHowMany(string str, out int aCount, out int bLastLine, out int aFirstLine). The function returns in the out parameter aCount the number of times the string str was found in a file named "Clex8.txt" returns in bLastLine the number of the last line in which str was found (or-1 if str is not found in the file); it returns in bFirstLine the number of the first line in which str was found (or -1 if str is not found in the file). For example, if the file contains the following lines: BAA CAA BAA BAA And there is a function call: countHowMany("BAA",out count, out last, out first) Then after the call completes count would be 3 (since BAA appears 3 times in the file), last would be 5 (since the last line in which BAA appears is line number 5), and first would be 2 (since the first line in which BAA appears is 2). If there is a function call: countHowMany("TRY",out count, out last, out first) Then after the call completes count would be 0, last would be -1, and first would be -1 (since "TRY" does not appear in the file)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started