Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Zad1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- FormatowanieTablicy();
- Losowanko();
- }
- int N; // Wymiar tablicy
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- FormatowanieTablicy();
- Losowanko();
- }
- public void FormatowanieTablicy()
- {
- N = (int)numericUpDown1.Value;
- // Formatowanie macierzy
- dataGridView1.RowCount = N;
- dataGridView1.ColumnCount = N;
- dataGridView2.RowCount = N;
- dataGridView2.ColumnCount = 1;
- dataGridView3.RowCount = N;
- dataGridView3.ColumnCount = 1;
- }
- public void Losowanko()
- {
- Random los = new Random();
- double losik;
- for (int j = 0; j < N; j++)
- {
- for (int i = 0; i < N; i++)
- {
- losik = los.Next(-100, 100) + los.NextDouble();
- dataGridView3[0, i].Value = losik.ToString("0.00");
- losik = los.Next(-100, 100) + los.NextDouble(); // Dodałem
- dataGridView1[j, i].Value = losik.ToString("0.00");
- }
- }
- }
- private void Losuj_Click(object sender, EventArgs e)
- {
- Losowanko();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement