C# Burç ve Yaş Hesaplama

c# Burç ve Yaş Hesaplama Programı
Merhabalar bu gün sizlere c# ile burç ve yaş hesaplama programı hazırladım doğruyu söylemek gerekirse beni biraz yordu.
Programım sizden doğum gününüzü istiyor ve hesapla butonuna bastığınızda sizin hem yaşınızı hesaplıyor hem de hangi burca sahip olduğunuzu sizlere söylüyor.
Umarım hazırladığım programı seversiniz.
Dosyaları indirmek için tıklayın.
Sormak istediğiniz sorularınızı bana yorum kısmından belirtmeyi unutmayın, Size yardımcı olacağım.👍
Form1.cs
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 burc_hesapla { public partial class Form1 : Form { public Form1() { InitializeComponent(); } string c_ay, burcu; int s_gun, s_ay, s_yil, gun, ay, yil,yas; private void Form1_Load(object sender, EventArgs e) { for(int i = 1; i <= 31; i++) { comboBox1.Items.Add(i.ToString()); } for (int i = 1990; i <= 2020; i++) { comboBox3.Items.Add(i.ToString()); } comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 0; comboBox3.SelectedIndex = 0; } private void button1_Click(object sender, EventArgs e) { gun = Convert.ToInt32(comboBox1.Text); ay_hesapla(); yil = Convert.ToInt32(comboBox3.Text); s_gun = DateTime.Now.Day; s_ay = DateTime.Now.Month; s_yil = DateTime.Now.Year; yas_hesapla(); burc_hesapla(ay, gun); label5.Text = burcu; label7.Text = yas.ToString()+" Yaşındasınız"; } public void yas_hesapla() { DateTime dogum_gunu = new DateTime(yil, ay, gun); DateTime bugun = DateTime.Today; yas = bugun.Year - dogum_gunu.Year; if (dogum_gunu > bugun.AddYears(-yas)) { yas--; } } public void ay_hesapla() { c_ay = comboBox2.SelectedItem.ToString(); if (c_ay == "Ocak") { ay = 01; } if (c_ay == "Şubat") { ay = 02; } if (c_ay == "Mart") { ay = 03; } if (c_ay == "Nisan") { ay = 04; } if (c_ay == "Mayıs") { ay = 05; } if (c_ay == "Haziran") { ay = 06; } if (c_ay == "Temmuz") { ay = 07; } if (c_ay == "Ağustos") { ay = 08; } if (c_ay == "Eylül") { ay = 09; } if (c_ay == "Ekim") { ay = 10; } if (c_ay == "Kasım") { ay = 11; } if (c_ay == "Aralık") { ay = 12; } } public void burc_hesapla(int b_ay,int b_gun) { if((b_gun >= 21 && b_ay == 3) || (b_gun <= 20 && b_ay == 4)) { burcu = "Koc"; } if ((b_gun >= 21 && b_ay == 4) || (b_gun <= 21 && b_ay == 5)) { burcu = "Boğa"; } if ((b_gun >= 22 && b_ay == 5) || (b_gun <= 22 && b_ay == 6)) { burcu = "İkizler"; } if ((b_gun >= 23 && b_ay == 6) || (b_gun <= 22 && b_ay == 7)) { burcu = "Yengeç"; } if ((b_gun >= 23 && b_ay == 7) || (b_gun <= 22 && b_ay == 8)) { burcu = "Aslan"; } if ((b_gun >= 23 && b_ay == 8) || (b_gun <= 22 && b_ay == 9)) { burcu = "Başak"; } if ((b_gun >= 23 && b_ay == 9) || (b_gun <= 22 && b_ay == 10)) { burcu = "Terazi"; } if ((b_gun >= 23 && b_ay == 10) || (b_gun <= 21 && b_ay == 11)) { burcu = "Akrep"; } if ((b_gun >= 22 && b_ay == 11) || (b_gun <= 21 && b_ay == 12)) { burcu = "Yay"; } if ((b_gun >= 22 && b_ay == 12) || (b_gun <= 21 && b_ay == 1)) { burcu = "Oğlak"; } if ((b_gun >= 22 && b_ay == 1) || (b_gun <= 19 && b_ay == 2)) { burcu = "Kova"; } if ((b_gun >= 20 && b_ay == 2) || (b_gun <= 20 && b_ay == 3)) { burcu = "Balık"; } } } }
Etiketler :
burç hesaplayaş hesaplac# burç hesaplac# yaş hesaplaburç hesaplama formülüyaş hesaplama formülü

Yorum Yap :

Yorum Gönder (0)
Daha yeni Daha eski