Ranglar va fon


Console.WriteLine(0.0234.ToString("‰##.00"))


Download 399.72 Kb.
bet8/8
Sana18.06.2023
Hajmi399.72 Kb.
#1585499
1   2   3   4   5   6   7   8
Bog'liq
4. Kiritish Chiqarish

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"));

Moslashtirilgan sonli formatlangan satrlar

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);

}

Dastur argumentlari

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?


Download 399.72 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling