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 WindowsFormsApp12
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void btn1_Click(object sender, EventArgs e)
- {
- int n = txtUnos.Text.Trim().Length;
- if (n > 25)
- {
- MessageBox.Show("Unesi manje!");
- return;
- }
- else
- {
- char[,] niz = new char[n, n];
- int k = 0;
- string str = "";
- char pom = ' ';
- int count = 0, zbir1 = 0, zbir2 = 0;
- List<char> lista1 = new List<char>();
- List<char> lista2 = new List<char>();
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- if (Convert.ToInt32(txtUnos.Text[j]) + k > 90)
- {
- niz[i, j] = Convert.ToChar((Convert.ToInt32(txtUnos.Text[j]) + k) - 26);
- }
- else
- {
- niz[i, j] = Convert.ToChar(Convert.ToInt32(txtUnos.Text[j]) + k);
- }
- str += niz[i, j].ToString() + " ";
- }
- k++;
- str += "\n";
- }
- richTextBox1.Text = str;
- for(int i = 0; i < n - 1; i++)
- {
- for (int j = 0; j < n; j++)
- {
- if (i == j)
- {
- if (niz[i, j] == niz[i + 1, j + 1])
- {
- MessageBox.Show(niz[i, j].ToString());
- }
- }
- if (i + j == n - 1)
- {
- if (niz[i, j] == niz[i + 1, j - 1])
- {
- MessageBox.Show(niz[i, j].ToString());
- }
- }
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment