Advertisement
Guest User

10

a guest
Dec 18th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1. namespace WindowsFormsApp1
  2. {
  3.     public partial class Form1 : Form
  4.     {
  5.         public Form1()
  6.         {
  7.             InitializeComponent();
  8.         }
  9.  
  10.         private void Form1_Load(object sender, EventArgs e)
  11.         {
  12.             string path = @"C:\N\input1.txt";
  13.             richTextBox1.LoadFile(path, RichTextBoxStreamType.PlainText);
  14.         }
  15.  
  16.         private void button1_Click_1(object sender, EventArgs e)
  17.         {
  18.             string text = richTextBox1.Text;
  19.             string[] s = text.Split(' ', '\n');
  20.             int[,] a = new int[4,4];
  21.             int k = 0;
  22.             int[] b = new int[4];
  23.             for (int i =0;i<4;++i)
  24.             {
  25.                 for (int j = 0;j<4;++j)
  26.                 {
  27.                     a[i, j] = int.Parse(s[k]);
  28.                     ++k;
  29.                     b[i] += a[i, j];
  30.                 }
  31.             }
  32.             richTextBox2.AppendText("Cуммы строк" + '\n');
  33.             for (int i =0; i<4;++i)
  34.             {
  35.                 richTextBox2.AppendText(b[i].ToString() + '\n');
  36.             }
  37.  
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement