Console.WriteLine(0.0234.ToString("‰##.00")); Console.WriteLine(0.0234.ToString("##.00e0")); Console.WriteLine(0.0234.ToString("##.00e+000")); Console.WriteLine(0.0234.ToString("##.##E-0")); double musbat = 1234; double manfiy = -1234; double nol = 0; string format1 = "##;(##)"; string format2 = "##;(##);**Zero**"; Console.WriteLine(musbat.ToString(format1)); Console.WriteLine("{0:" + format1 + "}", musbat); Console.WriteLine(manfiy.ToString(format1)); Console.WriteLine("{0:" + format1 + "}", manfiy); Console.WriteLine(nol.ToString(format2)); Console.WriteLine("{0:" + format2 + "}", nol); } static void Main(string[] args) { int a = Int32.Parse(args[0]); int b = Int32.Parse(args[1]); Console.WriteLine(a + b); }
Dastur Argumentlar
Klavish ma'lumotlarini olish Console.ReadKey() – foydalanuvchi tomonidan bosilgan belgi yoki funksional klavish ma'lumotlarini oladi. ConsoleKeyInfo obyektini qaytaradi va ConsoleKey konstantalarini yoki ConsoleModifiers qiymatlarini (Ctrl, Shift, Alt) bitli arifmetika orqali bosilganini aniqlaydi. static void Main(string[] args) { ConsoleKeyInfo cki = Console.ReadKey(); Console.WriteLine("Key: " + cki.Key); Console.WriteLine("KeyChar: " + cki.KeyChar); Console.WriteLine("Modifier: " + cki.Modifiers); if ((cki.Modifiers & ConsoleModifiers.Alt) != 0) Console.Write($"ALT+{cki.Key}"); if ((cki.Modifiers & ConsoleModifiers.Shift) != 0) Console.Write($"SHIFT+{cki.Key}"); if ((cki.Modifiers & ConsoleModifiers.Control) != 0) Console.Write($"CTRL+{cki.Key}"); } Savollar?
Do'stlaringiz bilan baham: |