public override string ToString() { string returnString = ""; returnString += "T: " + EnginesGUI.GUIUnitsSettings.TemperatureUnits.Format(T); returnString += " P: " + EnginesGUI.GUIUnitsSettings.PressureUnits.Format(P); returnString += " Rho: " + Rho.ToString("F2"); returnString += "\n FF: " + FF.ToString("F3"); returnString += "\n Cp: " + Cp.ToString("F2"); returnString += " Cv: " + Cv.ToString("F2"); returnString += "\nGamma: " + Gamma.ToString("F2"); returnString += " R: " + R.ToString("F2"); return(returnString); }
private static void writeOutputTxt(string[,] student, double[] studentAvg, string[] studentLetterGrade) { string path = @"output.txt"; // We specify the path of the file that we will read. FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); // Created a file stream object. StreamWriter sw = new StreamWriter(fs); // Created a StreamWriter object for reading. // Results will be printed to file and console. for (int i = 0; i < numberOfStudents; i++) // Will return as many as the number of students { sw.WriteLine(student[i, 0] + " " + student[i, 1] + " " + student[i, 2] + " - Student Average: " + studentAvg[i] + " - Letter Grade: " + studentLetterGrade[i]); Console.WriteLine(student[i, 0] + " " + student[i, 1] + " " + student[i, 2] + " - Student Average: " + studentAvg[i] + " - Letter Grade: " + studentLetterGrade[i]); } sw.WriteLine("\n- LETTER GRADE STATUS OF THE CLASS -"); sw.WriteLine("AA: " + AA.ToString() + " Person - " + Convert.ToInt32((AA * 100) / numberOfStudents) + "% OF THE CLASS"); sw.WriteLine("BA: " + BA.ToString() + " Person - " + Convert.ToInt32((BA * 100) / numberOfStudents) + "% OF THE CLASS"); sw.WriteLine("BB: " + BB.ToString() + " Person - " + Convert.ToInt32((BB * 100) / numberOfStudents) + "% OF THE CLASS"); sw.WriteLine("CB: " + CB.ToString() + " Person - " + Convert.ToInt32((CB * 100) / numberOfStudents) + "% OF THE CLASS"); sw.WriteLine("CC: " + CC.ToString() + " Person - " + Convert.ToInt32((CC * 100) / numberOfStudents) + "% OF THE CLASS"); sw.WriteLine("DC: " + DC.ToString() + " Person - " + Convert.ToInt32((DC * 100) / numberOfStudents) + "% OF THE CLASS"); sw.WriteLine("DD: " + DD.ToString() + " Person - " + Convert.ToInt32((DD * 100) / numberOfStudents) + "% OF THE CLASS"); sw.WriteLine("FD: " + FD.ToString() + " Person - " + Convert.ToInt32((FD * 100) / numberOfStudents) + "% OF THE CLASS"); sw.WriteLine("FF: " + FF.ToString() + " Person - " + Convert.ToInt32((FF * 100) / numberOfStudents) + "% OF THE CLASS"); Console.WriteLine("\n- LETTER GRADE STATUS OF THE CLASS -"); Console.WriteLine("AA: " + AA.ToString() + " Person - " + Convert.ToInt32((AA * 100) / numberOfStudents) + "% OF THE CLASS"); Console.WriteLine("BA: " + BA.ToString() + " Person - " + Convert.ToInt32((BA * 100) / numberOfStudents) + "% OF THE CLASS"); Console.WriteLine("BB: " + BB.ToString() + " Person - " + Convert.ToInt32((BB * 100) / numberOfStudents) + "% OF THE CLASS"); Console.WriteLine("CB: " + CB.ToString() + " Person - " + Convert.ToInt32((CB * 100) / numberOfStudents) + "% OF THE CLASS"); Console.WriteLine("CC: " + CC.ToString() + " Person - " + Convert.ToInt32((CC * 100) / numberOfStudents) + "% OF THE CLASS"); Console.WriteLine("DC: " + DC.ToString() + " Person - " + Convert.ToInt32((DC * 100) / numberOfStudents) + "% OF THE CLASS"); Console.WriteLine("DD: " + DD.ToString() + " Person - " + Convert.ToInt32((DD * 100) / numberOfStudents) + "% OF THE CLASS"); Console.WriteLine("FD: " + FD.ToString() + " Person - " + Convert.ToInt32((FD * 100) / numberOfStudents) + "% OF THE CLASS"); Console.WriteLine("FF: " + FF.ToString() + " Person - " + Convert.ToInt32((FF * 100) / numberOfStudents) + "% OF THE CLASS"); sw.Flush(); // txt created sw.Close(); // Close file fs.Close(); }
public static string[] ToParagraphs(this string text) { const char FF = (char)0x0C; // https://www.ascii-code.com return(text.Replace("\r", "").Replace("\n\n", FF.ToString()).Split(FF)); }
private void chatthings() { int reqs = 0; byte[] bytes = new byte[10025]; string ClientData = null; string response = null; string Count1 = null; NetworkStream netstream = null; string netDC = ""; while ((true)) { try { reqs++; try { netstream = clsock.GetStream(); } catch { netstream.Close(); netstream.Dispose(); } try { netstream.Read(bytes, 0, bytes.Length); } catch { netstream.Close(); netstream.Dispose(); } ClientData = Encoding.ASCII.GetString(bytes); try { ClientData = ClientData.Substring(0, ClientData.IndexOf("$")); if (ClientData == "3DF38FC9") { try { Program.transmit(ClientData, "a client has disconnected", true); } catch { } clientThread.Abort(); } } catch { netstream.Close(); } //ClientData = ClientData.Substring(0, ClientData.IndexOf("$")); Count1 = Convert.ToString(reqs); try { Program.transmit(ClientData, clientN, true); } catch { break; } } catch (Exception FF) { Console.WriteLine(FF.ToString()); } } }