Question: I need this assignment to find a file and read it, for some reason im getting file not found exception, its in my solution explorer

I need this assignment to find a file and read it, for some reason im getting file not found exception, its in my solution explorer for c#, in the same place the project is, help!

This is my code:

namespace LetterCountAssignment { public class HelloWorld { public static void Main() { //string str; int i, wrd, l; //str = Console.ReadLine(); string str = System.IO.File.ReadAllText(@"input.txt"); l = 1; wrd = 1; /* loop till end of string */ while (l <= str.Length - 1) { /* check whether the current character is white space or new line or tab character*/ if ((str[l] == '.' || str[l] == ' ' || str[l] == '\t' || str[l] == '!' || str[l] == ',' || str[l] == '?' || str[l] == ' ') && (str[l - 1] == 't' || str[l - 1] == 'e')) { wrd++; } l++; } Console.Write("There are {0} words ending in t or e", wrd); } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!