static void Main(string[] args) { Console.WriteLine("Esimene:"); Console.WriteLine("------------------------------------"); int WordsCount = 0; string Path = @"C:\games\tekst.txt"; string Text = new System.IO.StreamReader(Path).ReadToEnd(); WordsCount = Text.Split(' ').Length; Console.WriteLine("Tekstis on " + WordsCount + " sõna"); Console.WriteLine("------------------------------------"); Console.WriteLine("Teine ja kolmas:"); Console.WriteLine("------------------------------------"); var counts = Text.GroupBy(x => x).OrderBy(x => x.Key) .ToDictionary(x => x.Key, x => x.Count()); foreach (var item in counts) { Console.WriteLine("Tekstis on: " + item.Key + " " + item.Value + " tükki"); } Console.WriteLine("------------------------------------"); Console.WriteLine("Neljas:"); Console.WriteLine("------------------------------------"); Console.ReadLine(); }
static void Main(string[] args) { string input = new System.IO.StreamReader(args.Length > 0 ? args[0] : "01.txt").ReadToEnd(); string[] items = input.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries); string rules = ""; for (int i = 2; i < items.Length; i++) { rules += items[i] + '\n'; } logic = new Logic(items[0], items[1], rules); System.Console.WriteLine("Множество терминальных символов: " + items[0]); System.Console.WriteLine("Множество нетерминальных символов: " + items[1]); System.Console.WriteLine("Множество правил:"); foreach (string rule in logic.GetRules()) { System.Console.WriteLine(rule); } System.Console.WriteLine("\nПосле удаления цепных правил:"); foreach (string rule in logic.Transform()) { System.Console.WriteLine(rule); } System.Console.WriteLine("\nДля завершения нажмите любую клавишу..."); System.Console.ReadKey(); }
public ActionResult Index(HttpPostedFileBase archivoTXT) { try { //Obtengo la data del archivo string resultado = new System.IO.StreamReader(archivoTXT.InputStream).ReadToEnd(); //En este caso quiero separar por la coma, me devolvería 2 valores string[] datos = resultado.Split(','); string[] dtos = new string[10]; for (int i = 0; i < archivoTXT.ContentLength; i++) { // datos[i] = ColeccionJugadores.Instance.AgregarJugador(); // Array.Clear(datos(0,5)); } //Mi otro controlador necesita 2 parámetros //return RedirectToAction("Datos", new { nom = datos[0].ToString(), mail = datos[1].ToString() }); } catch (Exception ex) { ViewBag.mensaje = "Se produjo un error : " + ex.Message; } return(View()); }
public JsonResult DeleteImage() { bool status = false; string exception_message = string.Empty; string details = string.Empty; try { System.IO.Stream req = Request.InputStream; req.Seek(0, System.IO.SeekOrigin.Begin); string json = new System.IO.StreamReader(req).ReadToEnd(); string[] parameters = json.Split(new string[] { "=" }, StringSplitOptions.None); if (parameters.Length == 2 && parameters[0] == "Image_Id") { status = new ServiceReference1.Service1Client().delete_Image(int.Parse(parameters[1])); } } catch (Exception e) { exception_message = e.Message; details = e.InnerException.Message; } if (status) { return(Json(new { success = true })); } else { if (string.IsNullOrEmpty(exception_message)) { exception_message = "Failed to delete the image"; } return(Json(new { success = false, code = exception_message, message = details })); } }
public JsonResult DeleteLink(int id) { bool status = false; string exception_message = string.Empty; string details = string.Empty; try { System.IO.Stream req = Request.InputStream; req.Seek(0, System.IO.SeekOrigin.Begin); string json = new System.IO.StreamReader(req).ReadToEnd(); string[] parameters = json.Split(new string[] { "&" }, StringSplitOptions.None); Dictionary <string, string> dictionary = new Dictionary <string, string>(); for (int i = 0; i < parameters.Count(); i++) { string[] key_and_arg = parameters[i].Split(new string[] { "=" }, StringSplitOptions.None); dictionary.Add(key_and_arg[0], key_and_arg[1]); } status = new ServiceReference1.Service1Client().delete_Link(id, int.Parse(dictionary["Profile_Id"]), int.Parse(dictionary["Profile_Type_Id"])); } catch (Exception e) { exception_message = e.Message; details = e.InnerException.Message; } if (status) { return(Json(new { success = true })); } else { return(Json(new { success = false, code = exception_message, message = details })); } }
static void Main(string[] args) { string input = new System.IO.StreamReader(args.Length > 0 ? args[0] : "01.txt").ReadToEnd(); int rowsLength = input.Split(new char[] { '\r', '\n' }, System.StringSplitOptions.RemoveEmptyEntries).Length; double[] values = System.Array.ConvertAll( input.Split(new char[] { '\r', '\n', '\t' }, System.StringSplitOptions.RemoveEmptyEntries), item => System.Convert.ToDouble(item) ); double[,] table = new double[rowsLength, values.Length / rowsLength]; for (int i = 0; i < table.GetLength(0); i++) { for (int j = 0; j < table.GetLength(1); j++) { table[i, j] = values[i * table.GetLength(1) + j]; } } double[,] table_result = new Simplex(table).Calculate(out double[] result, out bool unsolvable); if (unsolvable) { System.Console.WriteLine("Нет допустимых решений."); } else { System.Console.WriteLine("Решённая симплекс-таблица:"); for (int i = 0; i < table_result.GetLength(0); i++) { for (int j = 0; j < table_result.GetLength(1); j++) { System.Console.Write(table_result[i, j] + (j < table_result.GetLength(1) - 1 ? "\t" : "\r\n")); } } System.Console.Write("\r\nРешение: "); for (int i = 1; i < table.GetLength(1); i++) { System.Console.Write("X(" + i + ") = " + result[i - 1] + (i < table.GetLength(1) - 1 ? ", " : ".")); } } System.Console.WriteLine("\r\nДля завершения нажмите любую клавишу..."); System.Console.ReadKey(); }
public static string[][] ReadTable(string path) { string readed = new System.IO.StreamReader(path, System.Text.Encoding.Default).ReadToEnd(); readed = readed.Replace("\r\n", "|"); string[] strArray = readed.Split(new char[] { '|' }); string[][] result = new string[strArray.Length][]; for (int i = 0; i < strArray.Length; i++) { result[i] = strArray[i].Split(' '); } return(result); }
public ActionResult Cook(int id) { // Return the input stream to 0 as it has already been read this.HttpContext.Request.InputStream.Position = 0; var result = new System.IO.StreamReader(this.HttpContext.Request.InputStream).ReadToEnd(); // Manually remove unnessesary chars. No need for another lib for just that, is there var selectedItems = result.Split(new char[] { '/', '"', '[', ']', ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToList(); var trainingId = int.Parse(this.Request.UrlReferrer.Segments[3]); var userId = this.User.Identity.GetUserId(); int matches = this.userTrainings.Cook(userId, trainingId, id, selectedItems); return this.Join(trainingId); }
/// <summary> /// /// </summary> /// <param name="num"></param> /// <param name="numbytes"></param> /// <param name="response"></param> /// <returns></returns> protected override bool parseStatus(ref int num, ref int numbytes, System.IO.MemoryStream response) { bool error = false; //Parse the result if (!error) { System.String resp = new System.IO.StreamReader(response).ReadToEnd(); String[] values = resp.Split(null, 3); try { num = System.Int32.Parse(values[1]); numbytes = System.Int32.Parse(values[2]); } catch (System.Exception e) { num = 0; numbytes = 0; if (log.IsErrorEnabled) { log.Error("Error while parsing STAT response", e); } } } return(!error); }
public static void ParsePostData(System.IO.Stream input, System.Collections.Hashtable form) { #region ParsePostData // Sometimes this can incorrectly be set by default. try { //TODO DUP string postData = new System.IO.StreamReader(input).ReadToEnd(); string[] afd = postData.Split("&".ToCharArray()); foreach (string fd in afd) { string[] afdv = fd.Split("=".ToCharArray()); form.Add(System.Web.HttpUtility.UrlDecode(afdv[0]), System.Web.HttpUtility.UrlDecode(afdv[1])); } } catch (System.Exception exception) { string thisIsAHackToIgnoreCompilerWarning = exception.Message; } #endregion }
public async Task <IActionResult> Index() { // Variables for use throughout. string[] sysArray = { "psn", "xbl", "battle", "uno", "acti" }; string url = "https://call-of-duty-modern-warfare.p.rapidapi.com/warzone-matches"; string line; int count = 0; // Retrieves the file count to set Array Size Dynamically. var filecounter = new System.IO.StreamReader("./PlayerNames.txt").ReadToEnd(); var lines = filecounter.Split(new char[] { '\n' }); var counted = lines.Length; // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader("./PlayerNames.txt"); //Make Dynamic to handle file size Player[] playersArr = new Player[counted]; while ((line = file.ReadLine()) != null) { foreach (string sys in sysArray) { // Handles slowing down the API calls. System.Threading.Thread.Sleep(1000); // Creates the URL Structure. var client = new RestClient($"{url}/{line}/{sys}"); // Creates the get request. var request = new RestRequest(Method.GET); // Authorization information. request.AddHeader("x-rapidapi-key", "Insert your key here"); request.AddHeader("x-rapidapi-host", "call-of-duty-modern-warfare.p.rapidapi.com"); // Creates Execute variable. var response = client.Execute(request); // Incase there's just an empty response (I have tried Null and "" to no success). if (response.Content == "{}") { Console.WriteLine("Empty Response!"); continue; } else { // Places the players content into a dictionary. Dictionary <string, dynamic> playerDict = JsonConvert.DeserializeObject <Dictionary <string, dynamic> >(response.Content); // Handles the error response if the user. if (playerDict.ContainsKey("error")) { Console.WriteLine("Broken - 404 Not Found"); continue; } // Handles all other cases. else { // Core arrays for the last 7 games. int[] kills = new int[7]; int[] deaths = new int[7]; int[] score = new int[7]; // Loop for iterating through last 7 games. for (int i = 0; i < 7; i++) { kills.SetValue(Convert.ToInt32(playerDict["matches"][i]["playerStats"]["kills"]), i); deaths.SetValue(Convert.ToInt32(playerDict["matches"][i]["playerStats"]["deaths"]), i); score.SetValue(Convert.ToInt32(playerDict["matches"][i]["playerStats"]["score"]), i); } // Creates new arrays containing top 5 values for each. int[] top5kills = kills.OrderByDescending(i => i).Take(5).ToArray(); int[] top5deaths = deaths.OrderByDescending(i => i).Take(5).ToArray(); int[] top5scores = score.OrderByDescending(i => i).Take(5).ToArray(); // Creates instance of the class. Player player = new Player(); player.UserName = line; // Sets players stats. player.Kills = top5kills.Sum(); player.Deaths = top5deaths.Sum(); player.Score = top5scores.Sum(); // Sets player in an array for later. playersArr.SetValue(player, count); IEnumerable <Player> playersSorted = playersArr.OrderByDescending(p => p.Kills).ThenBy(o => o.Deaths).ThenByDescending(n => n.Score); // ADD RANK TO PLAYER AFTER SORTING. Players = playersSorted; break; } } } count++; } //Handles applying rank after the players are sorted by score. int rankedPosition = 1; foreach (var p in Players) { p.Rank = rankedPosition; rankedPosition++; } return(View(Players)); }
public override void OnLoad(ConfigNode config) { var oldPath = KSPUtil.ApplicationRootPath + "saves/" + HighLogic.SaveFolder + "/kethane.cfg"; var oldConfig = ConfigNode.Load(oldPath); if (oldConfig != null) { config = oldConfig; System.IO.File.Delete(oldPath); } if (!config.HasValue("Version") && (config.CountNodes > 0 || config.CountValues > 2)) { try { config = upgradeConfig(config); } catch (Exception e) { Debug.LogError("[Kethane] Error upgrading legacy data: " + e); config = new ConfigNode(); } } var timer = System.Diagnostics.Stopwatch.StartNew(); PlanetDeposits.Clear(); Scans.Clear(); var resourceNodes = config.GetNodes("Resource"); foreach (var resource in KethaneController.ResourceDefinitions) { var resourceName = resource.Resource; var resourceNode = resourceNodes.SingleOrDefault(n => n.GetValue("Resource") == resourceName) ?? new ConfigNode(); PlanetDeposits[resourceName] = new Dictionary<string, IBodyResources>(); Scans[resourceName] = new Dictionary<string, Cell.Set>(); generatorNodes[resourceName] = resourceNode.GetNode("Generator") ?? resource.Generator; var generator = createGenerator(generatorNodes[resourceName].CreateCopy()); if (generator == null) { Debug.LogWarning("[Kethane] Defaulting to empty generator for " + resourceName); generator = new EmptyResourceGenerator(); } generators[resourceName] = generator; var bodyNodes = resourceNode.GetNodes("Body"); foreach (var body in FlightGlobals.Bodies) { var bodyNode = bodyNodes.SingleOrDefault(n => n.GetValue("Name") == body.name) ?? new ConfigNode(); PlanetDeposits[resourceName][body.name] = generator.Load(body, bodyNode.GetNode("GeneratorData")); Scans[resourceName][body.name] = new Cell.Set(MapOverlay.GridLevel); var scanMask = bodyNode.GetValue("ScanMask"); if (scanMask != null) { try { Scans[resourceName][body.name] = new Cell.Set(MapOverlay.GridLevel, Convert.FromBase64String(scanMask.Replace('.', '/').Replace('%', '='))); } catch (FormatException e) { Debug.LogError(String.Format("[Kethane] Failed to parse {0}/{1} scan string, resetting ({2})", body.name, resourceName, e.Message)); } } } } if (!config.HasValue("Version") || config.GetValue("Version") == "0.8") { var str = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Kethane.Resources.GridIndices.txt")).ReadToEnd(); var map = str.Split(',').Select(s => new Cell(uint.Parse(s))).ToArray(); foreach (var resource in KethaneController.ResourceDefinitions) { foreach (var body in FlightGlobals.Bodies) { var old = Scans[resource.Resource][body.name]; var set = new Cell.Set(MapOverlay.GridLevel); foreach (var cell in Cell.AtLevel(MapOverlay.GridLevel)) { set[cell] = old[map[cell.Index]]; } Scans[resource.Resource][body.name] = set; } } } timer.Stop(); Debug.LogWarning(String.Format("Kethane deposits loaded ({0}ms)", timer.ElapsedMilliseconds)); }
public override void OnLoad(ConfigNode config) { var oldPath = KSPUtil.ApplicationRootPath + "saves/" + HighLogic.SaveFolder + "/kethane.cfg"; var oldConfig = ConfigNode.Load(oldPath); if (oldConfig != null) { config = oldConfig; System.IO.File.Delete(oldPath); } if (!config.HasValue("Version") && (config.CountNodes > 0 || config.CountValues > 2)) { try { config = upgradeConfig(config); } catch (Exception e) { Debug.LogError("[Kethane] Error upgrading legacy data: " + e); config = new ConfigNode(); } } var timer = System.Diagnostics.Stopwatch.StartNew(); PlanetDeposits.Clear(); Scans.Clear(); var resourceNodes = config.GetNodes("Resource"); foreach (var resource in KethaneController.ResourceDefinitions) { var resourceName = resource.Resource; var resourceNode = resourceNodes.SingleOrDefault(n => n.GetValue("Resource") == resourceName) ?? new ConfigNode(); PlanetDeposits[resourceName] = new Dictionary <string, IBodyResources>(); Scans[resourceName] = new Dictionary <string, Cell.Set>(); generatorNodes[resourceName] = resourceNode.GetNode("Generator") ?? resource.Generator; var generator = createGenerator(generatorNodes[resourceName].CreateCopy()); if (generator == null) { Debug.LogWarning("[Kethane] Defaulting to empty generator for " + resourceName); generator = new EmptyResourceGenerator(); } generators[resourceName] = generator; var bodyNodes = resourceNode.GetNodes("Body"); foreach (var body in FlightGlobals.Bodies) { var bodyNode = bodyNodes.SingleOrDefault(n => n.GetValue("Name") == body.name) ?? new ConfigNode(); PlanetDeposits[resourceName][body.name] = generator.Load(body, bodyNode.GetNode("GeneratorData")); Scans[resourceName][body.name] = new Cell.Set(MapOverlay.GridLevel); var scanMask = bodyNode.GetValue("ScanMask"); if (scanMask != null) { try { Scans[resourceName][body.name] = new Cell.Set(MapOverlay.GridLevel, Convert.FromBase64String(scanMask.Replace('.', '/').Replace('%', '='))); } catch (FormatException e) { Debug.LogError(String.Format("[Kethane] Failed to parse {0}/{1} scan string, resetting ({2})", body.name, resourceName, e.Message)); } } } } if (!config.HasValue("Version") || config.GetValue("Version") == "0.8") { var str = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Kethane.Resources.GridIndices.txt")).ReadToEnd(); var map = str.Split(',').Select(s => new Cell(uint.Parse(s))).ToArray(); foreach (var resource in KethaneController.ResourceDefinitions) { foreach (var body in FlightGlobals.Bodies) { var old = Scans[resource.Resource][body.name]; var set = new Cell.Set(MapOverlay.GridLevel); foreach (var cell in Cell.AtLevel(MapOverlay.GridLevel)) { set[cell] = old[map[cell.Index]]; } Scans[resource.Resource][body.name] = set; } } } timer.Stop(); Debug.LogWarning(String.Format("Kethane deposits loaded ({0}ms)", timer.ElapsedMilliseconds)); }
private void button2_Click(object sender, EventArgs e) { //-----------------RSQ-------Requirement Sentence Quality---------------------------------------- string location = "C:/Users/PRATHYUSH/Desktop/text.txt"; System.IO.StreamWriter file = new System.IO.StreamWriter(location); file.WriteLine("------------------Requirement Sentence Quality---------------------"); var jarRoot = @"C:\Users\PRATHYUSH\Desktop\project files\stanford-postagger-full-2018-10-16"; var modelsDirectory = jarRoot + @"\models"; // Loading POS Tagger var tagger = new MaxentTagger(modelsDirectory + @"\wsj-0-18-bidirectional-nodistsim.tagger"); //---------------------------------------------------------------------------------------------------- string FilePath = path; string FileText = new System.IO.StreamReader(FilePath).ReadToEnd(); string[] SentenceArray = FileText.Split('.', '!', '?'); //string arrays containing the necessary words string[] ImplicitWords = { "this", "This", "these", "These", "that", "those", "it", "they", "they", "above", "below", "previous", "next", "following", "last", "and first" }; string[] OptionalWords = { "can", "eventually", "if appropriate", "if needed", "may", "optionally", "possibly" }; string[] VagueWords = { "adequate", "back", "bad", "clear", "close", "easy", "efficient", "far", "fast", "future", "good", "in front", "low", "near", "new", "old", "past", "recent", "significant", "slow", "strong", "today’s", "useful", "weak", "and well" }; string[] WeakWords = { "as a minimum", "as applicable", "as appropriate", "be able to", "be capable", "not limited to", "the capability of", "the capability to", "easy", "effective", "if practical", "normal", "provide for", "to be determined", "and timely" }; string[] DirectiveWords = { "figures", "for example", "table", "note", "i.e.", "e.g." }; string[] Continuances = { "below", "as follows", "following", "listed", "in particular", "support", "and" }; string[] imperatives = { "Shall", "shall", "Must", "must", "is required to", "Are Applicable", "Are to", "are to", "Responsible for", "will", "should" }; for (int i = 0; i < SentenceArray.Length; i++) { file.WriteLine(" "); file.WriteLine("Sentence {0}", i + 1); file.WriteLine(SentenceArray[i]); file.WriteLine("------ Multiple Sentence ------ "); object[] sentences = MaxentTagger.tokenizeText(new StringReader(SentenceArray[i])).toArray(); foreach (ArrayList sentence in sentences) { var taggedSentence = tagger.tagSentence(sentence); file.WriteLine(SentenceUtils.listToString(taggedSentence, false)); var myRegX = new Regex("/V"); MatchCollection m = myRegX.Matches(SentenceUtils.listToString(taggedSentence, false)); if (m.Count > 0) { file.WriteLine("Verb Count - " + m.Count); } } file.WriteLine("------ Implicit Words ------ "); for (int j = 0; j < ImplicitWords.Length; j++) { var myRegEx = new Regex("\\b" + ImplicitWords[j] + "\\b"); MatchCollection matches = myRegEx.Matches(SentenceArray[i]); int impword = matches.Count; imp = impword + imp; if (matches.Count > 0) { file.WriteLine(ImplicitWords[j] + " - " + matches.Count + " times"); } } file.WriteLine("------ Optional Words ------ "); for (int j = 0; j < OptionalWords.Length; j++) { var myRegEx = new Regex("\\b" + OptionalWords[j] + "\\b"); MatchCollection matches = myRegEx.Matches(SentenceArray[i]); int optword = matches.Count; opt = optword + opt; if (matches.Count > 0) { file.WriteLine(OptionalWords[j] + " - " + matches.Count + " times"); } } file.WriteLine("------ Vague Words ------ "); for (int j = 0; j < VagueWords.Length; j++) { var myRegEx = new Regex("\\b" + VagueWords[j] + "\\b"); MatchCollection matches = myRegEx.Matches(SentenceArray[i]); int vagword = matches.Count; vague = vagword + vague; if (matches.Count > 0) { file.WriteLine(VagueWords[j] + " - " + matches.Count + " times"); } } file.WriteLine("------ Weak Words ------ "); for (int j = 0; j < WeakWords.Length; j++) { var myRegEx = new Regex("\\b" + WeakWords[j] + "\\b"); MatchCollection matches = myRegEx.Matches(SentenceArray[i]); int Weword = matches.Count; weak = Weword + weak; if (matches.Count > 0) { file.WriteLine(WeakWords[j] + " - " + matches.Count + " times"); } } file.WriteLine("------ Directive Words ------ "); for (int j = 0; j < DirectiveWords.Length; j++) { var myRegEx = new Regex("\\b" + DirectiveWords[j] + "\\b"); MatchCollection matches = myRegEx.Matches(SentenceArray[i]); int diwords = matches.Count; direct = diwords + direct; if (matches.Count > 0) { file.WriteLine(DirectiveWords[j] + " - " + matches.Count + " times"); } } file.WriteLine("------ Continuance Words ------ "); for (int j = 0; j < Continuances.Length; j++) { var myRegEx = new Regex("\\b" + Continuances[j] + "\\b"); MatchCollection matches = myRegEx.Matches(SentenceArray[i]); int contwords = matches.Count; cont = contwords + cont; if (matches.Count > 0) { file.WriteLine(Continuances[j] + " - " + matches.Count + " times"); } } file.WriteLine("------ imperatives ------ "); for (int j = 0; j < imperatives.Length; j++) { var myRegEx = new Regex("\\b" + imperatives[j] + "\\b"); MatchCollection matches = myRegEx.Matches(SentenceArray[i]); int imptawords = matches.Count; impta = imptawords + impta; if (matches.Count > 0) { file.WriteLine(imperatives[j] + " - " + matches.Count + " times"); } } } file.WriteLine("------------ "); file.WriteLine("------ Total tally ------ "); file.WriteLine("DirectiveWords" + " - " + direct + " times"); file.WriteLine("weak words" + " - " + weak + " times"); file.WriteLine("vague words" + " - " + vague + " times"); file.WriteLine("optional words" + " - " + opt + " times"); file.WriteLine("implicit words" + " - " + imp + " times"); file.WriteLine("continuance words" + " - " + cont + " times"); file.WriteLine("imperative words" + " - " + impta + " times"); //-------------------------RDQ------Requirement Document Quality----------------------------------------- file.WriteLine("\r\n\r\n------------Requirement Document Quality-------------\r\n \r\n"); double LinesCount; int CharCount; double WordsCount; string Path = path; string Text = new System.IO.StreamReader(Path).ReadToEnd(); CharCount = Text.Trim().Length; //total char LinesCount = Text.Split('.', '!', '?').Length; //total lines WordsCount = Text.Split(' ').Length; // total Words file.WriteLine("Character count is {0} \r\n", CharCount); file.WriteLine("Word count is {0} \r\n", WordsCount); file.WriteLine("Line count is {0} \r\n", LinesCount); //finding the number of syllables string contents = System.IO.File.ReadAllText(path); int SCount = SyllableCount(contents); file.WriteLine("Syllable count is {0} \r\n", SCount); //finding the Flesch index file.WriteLine("finding the Flesch index: \r\n"); double ASL = WordsCount / LinesCount; file.WriteLine("Average Sentence Length"); file.WriteLine("{0}\r\n", ASL); double ASW = SCount / WordsCount; file.WriteLine("Average number of syllables per word"); file.WriteLine("{0}\r\n", ASW); double FRI = 206.835 - (1.015 * ASL) - (84.6 * ASW); file.WriteLine("The Flesch index is"); file.WriteLine("{0}\r\n", FRI); //printinh the ranges for flesch index value file.WriteLine("Flesch index ranges:\r\n \r\n100 - 90 \t very easy to read (5th grade) \r\n90 – 80 \t easy to read (6th grade) \r\n80 – 70 \t fairly easy to read (7th grade) \r\n70 – 60 \t plain english (8th & 9th grade) \r\n60 – 50 \t fairly difficult to read (10th - 12th grade) \r\n50 – 30 \t difficult to read (College) \r\n30 – 0 \t very difficult to read (College graduate) \r\n\r\n"); //finding the Automatic Readabilty index file.WriteLine("finding the Automatic readabilty index:\r\n"); double AVL = CharCount / WordsCount; file.WriteLine("the average number of letters per word"); file.WriteLine("{0}\r\n", AVL); double AVW = WordsCount / LinesCount; file.WriteLine("the average number of words in sentences"); file.WriteLine("{0}\r\n", AVW); double ARI = (AVL * 4.71) + (AVW * 0.5) - 21.43; file.WriteLine("The Automatic readability index is"); file.WriteLine("{0}\r\n", ARI); file.WriteLine("Automatic redability index ranges:\r\n \r\n10 - 11 \tFifth Grade. \r\n11 - 12 \tSixth Grade. \r\n12 - 13 \tSeventh Grade. \r\n13 - 14 \tEighth Grade. \r\n14 - 15 \tNinth Grade. \r\n15 - 16 \tTenth Grade. \r\n16 - 17 \tEleventh grade. \r\n17 - 20 \tTwelfth grade. \r\n20 - 24 \tCollege. \r\n24 - 27 \tCollege graduate."); file.Flush(); file.Close(); System.Console.WriteLine("The output is stored in the file {0}", location); }