示例#1
0
        public static string Str(int val)
        {
            bool minus = false;

            if (val < 0)
            {
                val = -val; minus = true;
            }

            int n = (int)val;

            StringBuilder r = new StringBuilder();

            if (0 == n)
            {
                r.Append("0 ");
            }
            if (n % 1000 != 0)
            {
                r.Append(Propis.Str(n, true, "", "", ""));
            }

            n /= 1000;

            r.Insert(0, Propis.Str(n, false, "тысяча", "тысячи", "тысяч"));
            n /= 1000;

            r.Insert(0, Propis.Str(n, true, "миллион", "миллиона", "миллионов"));
            n /= 1000;

            r.Insert(0, Propis.Str(n, true, "миллиард", "миллиарда", "миллиардов"));
            n /= 1000;

            r.Insert(0, Propis.Str(n, true, "триллион", "триллиона", "триллионов"));
            n /= 1000;

            r.Insert(0, Propis.Str(n, true, "триллиард", "триллиарда", "триллиардов"));
            if (minus)
            {
                r.Insert(0, "минус ");
            }


            r[0] = char.ToUpper(r[0]);

            return(r.ToString());
        }
示例#2
0
        public void Write()
        {
            int val = Console.Read();

            Console.WriteLine(Propis.Str(val));
        }