Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void WriteFile(string filename, string text)
- {
- File.WriteAllText(filename, text);
- }
- static string ReadFile(string filename)
- {
- return File.ReadAllText(filename);
- }
- private void btnAddNr_Click(object sender, EventArgs e)
- {
- string text = txtInput.Text;
- WriteFile(filename, text + Environment.NewLine);
- }
- private void btnGetMean_Click(object sender, EventArgs e)
- {
- string text = ReadFile(filename);
- string[] lines = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
- int summa = 0;
- foreach (string line in lines)
- {
- summa += Convert.ToInt16(line);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement