C# - Sayı Okuma

  1. KısayolKısayol reportŞikayet pmÖzel Mesaj
    saybirs
    saybirs's avatar
    Kayıt Tarihi: 24/Temmuz/2009
    Erkek

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    
    namespace sayı_okuma
    {
        public partial class Form1 : Form
        {
            int i,yer;
            string [] birler=new string[10]{"","BİR","İKİ","ÜÇ","DÖRT","BEŞ","ALTI","YEDİ","SEKİZ","DOKUZ"};
            string[] onlar = new string[10] { "", "ON", "YİRMİ", "OTUZ", "KIRK", "ELLİ", "ALTMIŞ", "YETMİŞ", "SEKSEN", "DOKSAN" };
            public Form1()
            {
                InitializeComponent();
            }
    
            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                yer=comboBox1.SelectedIndex;
                if (comboBox1.Text.Length == 1)
                {
                    if (comboBox1.SelectedIndex == 0)
                        label2.Text = "SIFIR";
                    else
                    {
                        
                        label2.Text = birler[yer];
                    }
                }
                else if (comboBox1.Text.Length == 2)
                {
                    label2.Text = onlar[Convert.ToInt32(comboBox1.Text.Substring(0, 1))] + " " + birler[Convert.ToInt32(comboBox1.Text.Substring(1, 1))];
                }
                else
                {
                    if (comboBox1.Text.Substring(0, 1) == "1")
                        label2.Text = "YÜZ" + " " + onlar[Convert.ToInt32(comboBox1.Text.Substring(1, 1))] +" "+ birler[Convert.ToInt32(comboBox1.Text.Substring(2, 1))];
                    else
                    {
                        label2.Text = birler[Convert.ToInt32(comboBox1.Text.Substring(0, 1))] + "YÜZ" + " " + onlar[Convert.ToInt32(comboBox1.Text.Substring(1, 1))] +" "+ birler[Convert.ToInt32(comboBox1.Text.Substring(2, 1))];
                    }
                }
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                for (i = 0; i < 1000; i++)
                {
                    comboBox1.Items.Add(i);
                }
            }
        }
    }
     
    Tasarım ve kodlar sadece bana aittir.Hiçbir şekilde biryerden alıntı yapılmamıştır.
Toplam Hit: 1647 Toplam Mesaj: 1