Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- using System.Text;
- using System.Threading;
- class Program
- {
- enum Colors { Red = 1, Green, Blue }
- static void Main()
- {
- // Console.Write("Stoyan\r\n" );
- //Console.Write("Stoyan" + Environment.NewLine);
- //Console.Write("Ivan" + Environment.NewLine);
- //Console.Write("Petko" + Environment.NewLine);
- /*
- int a = 5;
- // string s = "The value of a is ";
- Console.WriteLine(a);
- Console.WriteLine("The value of a is " + (a + 6));
- int age = 52;
- string name = "Stoyan";
- Console.WriteLine("My name is {0}. I am {1} years old!", name, age, "extra");
- Console.WriteLine($"My name is {name}. I am {age} years old!");
- */
- // index[,aligment][:stringFormat]
- // Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-CA");
- // Thread.CurrentThread.CurrentCulture = new CultureInfo("es-ES");
- //Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
- // Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- //// 1. Number standard
- //Console.WriteLine("Your balance is {0,-20:C2}", 12333.3445); // + 34.45678
- //for (int i = 0; i < 10; i++)
- //{
- // Console.WriteLine("{0,20:C2}|{1,20:c4}", 12333.3445, 432432.4567);
- //}
- //Console.WriteLine("This number: {0:D6}", 23);
- //Console.WriteLine("This number: {0:F3}", 24234343.43254);
- //Console.WriteLine("This number: {0:N3}", 24234343.43254);
- //Console.WriteLine("This number: {0:P4}", 0.43254);
- //Console.WriteLine("This number: {0:X4}", 43254);
- // 1.2. NUmber Custom
- // Console.WriteLine("This number: {0:000000.###########}", 43254.432);
- // 2. Date
- // DateTime today = new DateTime(2015, 11, 7, 12, 14, 34);
- // Console.WriteLine(today);
- // 2.1. standard
- //Console.WriteLine("Today is: {0:D}", today);
- //Console.WriteLine("Today is: {0:d}", today);
- //Console.WriteLine("Today is: {0:T}", today);
- //Console.WriteLine("Today is: {0:Y}", today);
- //Console.WriteLine("Today is: {0:y}", today);
- //// 2.2. Custom
- //Console.WriteLine("Today is: {0:yyyy+MM+dd}", today);
- // 3. Enum standard
- // Console.WriteLine((int)Colors.Blue);
- //Console.WriteLine("{0:G}", Colors.Blue);
- //Console.WriteLine("{0:D}", Colors.Blue);
- //Console.WriteLine("{0:X}", Colors.Blue);
- // 2.Reading
- // int c = Console.Read();
- // Console.ReadLine();
- // Console.ReadKey();
- // Console.WriteLine("Char {0} is {1}", (char)c, c);
- // Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
- // 2.1. Parse
- //Console.Write("How old are you?: ");
- //string ageString = Console.ReadLine();
- //int age = int.Parse(ageString);
- //Console.WriteLine(age + 10);
- //Console.Write("What is your balance?: ");
- //string balanceString = Console.ReadLine();
- //float balance = 0.0f;
- //try
- //{
- // balance = float.Parse(balanceString);
- //}
- //catch (FormatException)
- //{
- // Console.WriteLine("Please enter the correct data!");
- //}
- //Console.WriteLine("My balance will be {0:N5}", balance);
- // 2.1.TryParse
- //Console.Write("What is your balance?: ");
- //string balanceString = Console.ReadLine();
- //float balance = 0.0f;
- //bool isCorrect = float.TryParse(balanceString, out balance);
- //if (isCorrect)
- //{
- // Console.WriteLine("Thank you!");
- //}
- //else
- //{
- // Console.WriteLine("Please enter the correct data!");
- //}
- //Console.WriteLine(balance);
- //Console.Write("What is your balance?: ");
- //string balanceString = Console.ReadLine();
- //try
- //{
- // float balance = Convert.ToSingle(balanceString);
- //}
- //catch (FormatException)
- //{
- // Console.WriteLine("Please enetr the correct data!");
- //}
- ConsoleKeyInfo cki = Console.ReadKey();
- Console.WriteLine("Key: " + cki.Key);
- Console.WriteLine("KeyChar: " + cki.KeyChar);
- Console.WriteLine("Modifiers: " + cki.Modifiers);
- int x = 0, y = 10;
- Console.Clear();
- do
- {
- while (!Console.KeyAvailable)
- {
- Console.Clear();
- Console.SetCursorPosition(x, y);
- Console.WriteLine("*");
- if ( x < 79) x++;
- System.Threading.Thread.Sleep(100);
- }
- cki = Console.ReadKey();
- Console.SetCursorPosition(10, 1);
- Console.BackgroundColor = ConsoleColor.Blue;
- Console.ForegroundColor = ConsoleColor.Gray;
- Console.WriteLine("I am here and now!");
- } while (cki.Key != ConsoleKey.RightArrow);
- // Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
- // Console.InputEncoding = Encoding.UTF8;
- // Console.OutputEncoding = Encoding.ASCII;
- //Console.OutputEncoding = Encoding.UTF8;
- //Console.WriteLine("Това е кирилица: ☺");
- //Console.Write("Enter person name: ");
- //string person = Console.ReadLine();
- //Console.Write("Enter company name: ");
- //string company = Console.ReadLine();
- //Console.WriteLine(" Dear {0},", person);
- //Console.WriteLine("We are pleased to tell you that " +
- // "{1} has accepted you to take part in the \"Programming Basics\"" +
- // " course. {1} wishes you a good luck!", person, company);
- //Console.WriteLine(" Yours,");
- //Console.WriteLine(" {0}", company);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment