123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- 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 dyakonovcalc
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (textBox1.Text == "" || textBox2.Text == "")
- {
- label1.Text = "Введите значения";
- }
- else
- {
- double a = Convert.ToInt32(textBox1.Text);
- double b = Convert.ToInt32(textBox2.Text);
- textBox3.Text = Convert.ToString(a + b);
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- if (textBox1.Text == "" || textBox2.Text == "")
- {
- label1.Text = "Введите значения";
- }
- else
- {
- double a = Convert.ToInt32(textBox1.Text);
- double b = Convert.ToInt32(textBox2.Text);
- textBox3.Text = Convert.ToString(a - b);
- }
- }
- private void button3_Click(object sender, EventArgs e)
- {
- if (textBox1.Text == "" || textBox2.Text == "")
- {
- label1.Text = "Введите значения";
- }
- else
- {
- double a = Convert.ToInt32(textBox1.Text);
- double b = Convert.ToInt32(textBox2.Text);
- textBox3.Text = Convert.ToString(a * b);
- }
- }
- private void button4_Click(object sender, EventArgs e)
- {
- if (textBox2.Text == "0" || textBox2.Text == "")
- {
- label1.Text = "На ноль делить нельзя";
- }
- else
- {
- double a = Convert.ToInt32(textBox1.Text);
- double b = Convert.ToInt32(textBox2.Text);
- textBox3.Text = Convert.ToString(a / b);
- }
- }
- private void button5_Click(object sender, EventArgs e)
- {
- if (textBox1.Text == "" || textBox2.Text == "")
- {
- label1.Text = "Введите значения";
- }
- else
- {
- double a = Convert.ToInt32(textBox1.Text);
- double b = Convert.ToInt32(textBox2.Text);
- textBox3.Text = Convert.ToString(Math.Pow(a,b));
- }
- }
- private void button6_Click(object sender, EventArgs e)
- {
- if (textBox1.Text == "" || textBox2.Text == "")
- {
- label1.Text = "Введите значения";
- }
- else
- {
- double a = Convert.ToInt32(textBox1.Text);
- double b = Convert.ToInt32(textBox2.Text);
- textBox3.Text = Convert.ToString(Math.Pow(a, 1/b));
- }
- }
- }
- }
|