C SHARP – FORM APPLİCATİON – SİLİNDİRİN HACMİNİ HESAPLAMA


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 SilindirHacmi
{
    public partial class Form1 : Form
    {
        double hacim, yaricap , yukseklik;
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
        }
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://www.programlamadersleri.com");
        }
        private void buttonHesapla_Click(object sender, EventArgs e)
        {
            yaricap = Convert.ToDouble(textBoxYaricap.Text);
            yukseklik = Convert.ToDouble(textBoxYukseklik.Text);
            //Textbox'a girilen yaricap ve yükseklik alınıyor
            hacim = Math.PI * Math.Pow(yaricap, 2) * yukseklik;
            //V = π.r2.h  
            //Hacim Hesaplanıyor
            //Math.PI = Pi sayısını tam olarak verir
            //Math.Pow = Üs alma işlemini gerçekleştirir
            if (radioButtonCM.Checked)
            {//Eğer radio button seçili ise aşağıdaki işlemleri yap
                labelSilindirHacmi.Text = Math.Round(hacim,2).ToString() + "cm³";
                //Hacim cm cinsinden ekrana yazdırılıyor
                //Math.Round fonksiyonu ile sayıyı yuvarlıyor
                //ve virgülden sonra sadece 2 rakamı ekrana yazdırıyoruz
            }
            else{//www.dersimkodlama.blogspot.com
                labelSilindirHacmi.Text = Math.Round(hacim, 2).ToString() + "m³";
            }
        }
    }
}
ÖNCEKİ YAYIN
« Prev Post
SONRAKİ YAYIN
Next Post »

SAYFAMIZA ABONE OLARAK YORUMUNUZU YAPABİLİRSİNİZ Show Conversion Code Hide Conversion Code Show Emoticon Hide Emoticon

Thanks for your comment