11 Mayıs 2012 Cuma

ÜÇGEN TÜR-ALAN-ÇEVRE HESABI


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
        double alan, cevre;
        if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text                             == "")
            {textBox5.Text="Gerekli Yerleri Doldurunuz";
                textBox6.Text="Gerekli Yerleri Doldurunuz";
            }
            else
            {
                textBox5.Text = "";
                textBox6.Text = "";
                alan = Convert.ToDouble(textBox2.Text) * Convert.ToDouble(textBox3.Text) / 2;
                textBox6.Text = Convert.ToString(alan);
                cevre = Convert.ToDouble(textBox2.Text) + Convert.ToDouble(textBox1.Text) +             Convert . ToDouble(textBox4.Text);
                textBox5.Text = Convert.ToString(cevre);
           
            } 
        }

        private void hesaplatür_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == textBox2.Text)
                if (textBox1.Text == textBox4.Text)
                    if (textBox2.Text == textBox4.Text)
                    {
                        textBox7.Text = "Eşkenar Üçgen";

                    }
                    else
                    {
                        if (textBox1.Text == textBox2.Text && textBox1.Text != textBox4.Text)
                        if (textBox1.Text == textBox4.Text && textBox1.Text != textBox2.Text)
                        if (textBox2.Text == textBox4.Text && textBox2.Text !=   textBox1.Text)
                                {
                                    textBox7.Text = "İkizkenar Üçgen";
                                }
                    }
                   else
                {
          if (textBox1.Text != textBox2.Text && textBox1.Text != textBox4.Text && textBox2.Text != textBox4.Text)
                    {
                        textBox7.Text = "Çeşit Kenar Üçgen";
                    }
                }
                   else
            {
                textBox7.Text = "Boşlukları Doldurunuz";
            }

        }

      
    }
}

1 yorum:

  1. ikizkenar ve çeşitkenar üçgeni bir türlü bulamıyorum? ne denediysem olmadı bir yardım edermisiniz bana ya mantık hatası var yada başka bir problem? ayrıca textbox3.text in ne amaçla eklendiğinide anlamadım? hiç bir görevi yok gibi duruyor? yardımınız için şimdiden teşekkürler..

    YanıtlaSil