Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace WindowsFormsApp1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- string path = @"C:\N\input1.txt";
- richTextBox1.LoadFile(path, RichTextBoxStreamType.PlainText);
- }
- private void button1_Click_1(object sender, EventArgs e)
- {
- string text = richTextBox1.Text;
- string[] s = text.Split(' ', '\n');
- int[,] a = new int[4,4];
- int k = 0;
- int[] b = new int[4];
- for (int i =0;i<4;++i)
- {
- for (int j = 0;j<4;++j)
- {
- a[i, j] = int.Parse(s[k]);
- ++k;
- b[i] += a[i, j];
- }
- }
- richTextBox2.AppendText("Cуммы строк" + '\n');
- for (int i =0; i<4;++i)
- {
- richTextBox2.AppendText(b[i].ToString() + '\n');
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement