Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Net;
- class DemoLive
- {
- static void Main()
- {
- /*
- // int[] myArray;
- // int[] myArray = new int[5];
- //int[] myArray = new int[3] { 1, 2, 3 };
- int[] myArray = { 1, 2, 3};
- myArray[1] = 120;
- for (var i = 0; i < myArray.Length; i++)
- {
- Console.WriteLine(myArray[i]);
- }
- Console.WriteLine(myArray.Sum());
- Console.WriteLine(myArray.Min());
- Console.WriteLine(myArray.Max());
- Console.WriteLine(myArray.First<int>());
- Console.WriteLine(myArray.Last<int>());
- */
- /*
- string[] ourNames = { "Stoyan", "Ivan", "Petko" };
- ourNames[1] = "Zweda";
- foreach (string name in ourNames)
- {
- Console.WriteLine(name);
- }
- */
- /*
- int[,] my2DimensionsArray;
- // Ask the user for the size
- int width = int.Parse(Console.ReadLine());
- int height = int.Parse(Console.ReadLine());
- my2DimensionsArray = new int[width, height];
- */
- /*
- // int[,] my2DimensionsArray = new int[3, 3];
- int[,] my2DimensionsArray = new int[3, 3] {
- {1,2,3 },
- {1,2,3 },
- {1,2,3 }
- };
- my2DimensionsArray[0, 1] = 120;
- for(var i = 0; i < my2DimensionsArray.GetLength(0); i++)
- {
- for (var j=0; j< my2DimensionsArray.GetLength(1); j++)
- {
- Console.Write("{0,10}",my2DimensionsArray[i,j]);
- }
- Console.WriteLine();
- }
- */
- /*
- int[,,] my3DimensionsArray = new int[3,3,3]
- {
- { {1,2,3 }, { 1,2,3 }, {1,2,3 } },
- { {1,2,3 }, { 1,2,3 }, {1,2,3 } },
- { {1,2,3 }, { 1,2,3 }, {1,2,3 } }
- };
- */
- /*
- int[][] myArrayOfArrays = {
- new int[2] {1,2},
- new int[3] {1,2,3},
- new int[4] {1,2,3,4},
- new int[2] {1,2}
- };
- */
- /*
- int width = 4, height = 6;
- string[,] matrix =
- new string[height, width];
- for (int row = 0; row < height; row++)
- {
- for (int col = 0; col < width; col++)
- {
- matrix[row, col] = "" +
- (char)('a' + row) +
- (char)('a' + col);
- }
- }
- for (int row = 0; row < height; row++)
- {
- for (int col = 0; col < width; col++)
- {
- Console.Write("{0,10}",matrix[row, col]);
- }
- Console.WriteLine();
- }
- */
- /*
- for (int i = 0; i < 10; i++)
- {
- //for (var j = 0; j < i; j++)
- //{
- // Console.Write("-");
- //}
- // PrintHyphens(i, 2,3,4,4);
- PrintHyphens(3, j : i);
- Console.WriteLine();
- }
- }
- public static void PrintHyphens(int t, int n =10, int j = 4) // params int[] myParams)
- {
- for (var j = 0; j < n; j++)
- {
- // Console.Write("{0}, {1}", 2,3);
- Console.Write("-");
- }
- */
- /*
- Console.WriteLine(CalcTriangleArea(2.3, 4.5));
- Console.WriteLine(CalcTriangleArea(10, 4.5));
- Console.WriteLine(CalcTriangleArea(23, 4.5));
- */
- /*
- DateTime today = DateTime.Now;
- today = today.AddDays(2);
- Console.WriteLine(today);
- double cosine =Math.Cos(Math.PI* 60 /180 );
- Console.WriteLine(cosine);
- */
- /*
- Random rnd = new Random();
- for (int i = 0; i < 10; i++)
- {
- Console.WriteLine(rnd.Next(1, 10));
- }
- */
- /*
- DateTime today = DateTime.Now;
- Console.WriteLine("Today is: " + today);
- DateTime tomorrow = today.AddDays(1);
- Console.WriteLine("Tomorrow is: " + tomorrow);
- double angleDegrees = 60;
- double angleRadians = angleDegrees * Math.PI / 180;
- Console.WriteLine(Math.Cos(angleRadians));
- Random rnd = new Random();
- Console.WriteLine(rnd.Next(1, 100));
- WebClient webClient = new WebClient();
- webClient.DownloadFile("http://example.com", "file.txt");
- Process.Start("file.txt");
- */
- /*
- List<int> numbers = new List<int>();
- numbers.Add(1);
- numbers.Add(2);
- numbers.Add(3);
- for (int i = 0; i < numbers.Count; i++)
- {
- Console.WriteLine(numbers[i]);
- }
- */
- /*
- List<string> names =
- new List<string>() { "Peter", "Maria", "Katya", "Todor" };
- names.Add("Nakov"); // Peter, Maria, Katya, Todor, Nakov
- names.RemoveAt(0); // Maria, Katya, Todor, Nakov
- names.Insert(3, "Sylvia"); // Maria, Katya, Todor, Sylvia, Nakov
- names[1] = "Michael"; // Maria, Michael, Todor, Sylvia, Nakov
- foreach (var name in names)
- {
- Console.WriteLine(name);
- }
- */
- /*
- Dictionary<string, string> phonebook = new Dictionary<string, string>();
- phonebook["John Smith"] = "+1-555-8976";
- phonebook["Lisa Smith"] = "+1-555-1234";
- phonebook["Sam Doe"] = "+1-555-5030";
- phonebook["Nakov"] = "+359-899-555-592";
- phonebook["Nakov"] = "+359-2-981-9819";
- phonebook.Remove("John Smith");
- foreach (var pair in phonebook)
- {
- Console.WriteLine("{0} --> {1}", pair.Key, pair.Value);
- }
- */
- /*
- Dictionary<DateTime, string> events =
- new Dictionary<DateTime, string>();
- events[new DateTime(1998, 9, 4)] = "Google's birth date";
- events[new DateTime(2013, 11, 5)] = "SoftUni's birth date";
- events[new DateTime(1975, 4, 4)] = "Microsoft's birth date";
- events[new DateTime(2004, 2, 4)] = "Facebook's birth date";
- events[new DateTime(2013, 11, 5)] =
- "Nakov left Telerik Academy to establish SoftUni";
- foreach (var entry in events)
- {
- Console.WriteLine("{0:dd-MMM-yyyy}: {1}",
- entry.Key, entry.Value);
- }
- */
- /*
- string str = "SoftUni";
- Console.WriteLine(str);
- for (int i = 0; i < str.Length; i++)
- {
- Console.WriteLine("str[{0}] = {1}", i, str[i]);
- }
- Console.WriteLine(str.IndexOf("Uni")); // 4
- Console.WriteLine(str.IndexOf("uni")); // -1 (not found)
- Console.WriteLine(str.Substring(4, 3)); // Uni
- Console.WriteLine(str.Replace("Soft", "Hard")); // HardUni
- Console.WriteLine(str.ToLower()); // softuni
- Console.WriteLine(str.ToUpper()); // SOFTUNI
- */
- /*
- string firstName = "Steve";
- string lastName = "Jobs";
- int age = 56;
- Console.WriteLine(firstName + " " + lastName +
- " (age: " + age + ")"); // Steve Jobs (age: 56)
- string allLangs = "C#, Java; HTML, CSS; PHP, SQL";
- string[] langs = allLangs.Split(new char[] { ',', ';', ' ' },
- StringSplitOptions.RemoveEmptyEntries);
- foreach (var lang in langs)
- Console.WriteLine(lang);
- Console.WriteLine("Langs = " + string.Join(", ", langs));
- Console.WriteLine(" \n\n Software University ".Trim());
- */
- Person[] persons = new Person[2];
- Person stoyan = new Person();
- stoyan.Name = "Stoyan";
- stoyan.Age = 52;
- Person mariya = new Person();
- mariya.Name = "Mariya";
- mariya.Age = 20;
- // Console.WriteLine("is am a human. My name is {0}. I am {1} years old!", stoyan.Name, stoyan.Age);
- // Console.WriteLine("is am a human. My name is {0}. I am {1} years old!", mariya.Name, mariya.Age);
- stoyan.Introduce();
- mariya.Introduce();
- persons[0] = stoyan;
- }
- public static double CalcTriangleArea(double width, double height)
- {
- return width * height / 2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment