1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- 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 PR6
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- int a = Convert.ToInt32(textBox2.Text);
- int b = Convert.ToInt32(textBox1.Text);
- int c = Convert.ToInt32(textBox3.Text);
- if (a < b + c && b < a + c && c < a + b)
- {
- if (a == b && a == c && c == b)
- {
- label6.Text = "равносторонний";
-
- }
- else if (a == b || a == c || b == c)
- {
- label6.Text = "равнобедренный";
- }
- else
- {
- label6.Text = "разносторонний";
- }
- }
- else
- {
- label6.Text = "треугольник не существует";
- }
- }
- private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
- {
- char number = e.KeyChar;
- if (!Char.IsDigit(number) && number != 8)
- {
- e.Handled = true;
- }
- }
- private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
- {
- char number = e.KeyChar;
- if (!Char.IsDigit(number) && number != 8)
- {
- e.Handled = true;
- }
- }
- private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
- {
- char number = e.KeyChar;
- if (!Char.IsDigit(number) && number != 8)
- {
- e.Handled = true;
- }
- }
- }
- }
|