Advertisement
imedvedev

ООП 3

Mar 9th, 2014
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.57 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication2
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void button1_Click(object sender, EventArgs e)
  21.         {
  22.             double x = Convert.ToDouble(textBox1.Text),
  23.             y = Convert.ToDouble(textBox2.Text),
  24.             r = Convert.ToDouble(textBox3.Text),
  25.             a = Convert.ToDouble(textBox5.Text),
  26.             b = Convert.ToDouble(textBox6.Text);
  27.  
  28.             if (((x >= -r) && (x <= 0) && (y <= 0) && (y >= -b) && (Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2)) <= r)) | ((x <= a) && (x >= r) && (y >= 0) && (y <= -b) && (Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2)) <= r)))
  29.             {
  30.                 textBox4.Text = "Точка (" + x.ToString() + ", " + y.ToString() + ") входит в область";
  31.             } else {
  32.                 textBox4.Text = "Точка (" + x.ToString() + ", " + y.ToString() + ") не входит в область";
  33.             }
  34.         }
  35.  
  36.         private void button2_Click(object sender, EventArgs e)
  37.         {
  38.             textBox1.Text = "";
  39.             textBox2.Text = "";
  40.             textBox3.Text = "";
  41.             textBox4.Text = "";
  42.         }
  43.  
  44.         private void button3_Click(object sender, EventArgs e)
  45.         {
  46.             Close();
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement