Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp20
- {
- internal class Program
- {
- private static void Main(string[] args)
- {
- #region sortowanie bąbelkowe
- //int[] tab = { 4, 3, -3, 2, 9, 1, -2, 8, 3, 0 };
- //int tmp;
- //int i = 0;
- //for (int j = 0; j < 9; j++)
- //{
- // for (i = 0; i < 9; i++)
- // {
- // if (tab[i] > tab[i + 1])
- // {
- // tmp = tab[i]; tab[i] = tab[i + 1]; tab[i + 1] = tmp;
- // }
- // }
- //}
- //for (i = 0; i <= 9; i++)
- //{
- // Console.Write(tab[i] + " ");
- //}
- //Console.ReadKey();
- #endregion
- #region tablica dwuwymiarowa
- //int[,] t1 = {
- // { 1, 2, 6, 2, 7 },
- // { 2, 2, 4, 4, 5 },
- // { 3, 6, 3, 8, 4 },
- // { 4, 8, 8, 4, 1 },
- // { 5, 2, 6, 3, 1 }
- // };
- //int i = 0, su = 0;
- //int kol;
- //Console.WriteLine("Która kolumna?");
- //kol = Convert.ToInt16(Console.ReadLine());
- //for (i = 0; i < 5; i++)
- //{
- // su += t1[i, kol - 1];
- //}
- //Console.WriteLine(su);
- //Console.ReadKey();
- #endregion
- #region tablica znakowa
- //int ile = 0;
- //string tekst = "Programowanie w języku C sharp to istna szarpanina";
- //for (int n = 0; n < tekst.Length; n++)
- //{
- // if (tekst[n] == ' ') //sprawdzanie każdego znaku po kolei
- // {
- // ile++;
- // }
- //}
- //Console.WriteLine("Słów jest: " + (1 + ile));
- //Console.ReadKey();
- #endregion
- #region wstawianie
- //string ja = "Kacper Walkowski";
- //ja = ja.Insert(ja.IndexOf(' '), " Maciej"); // ja.Insert(po którym znaku chcemy wstawić, "co chcemy wstawić")
- //Console.WriteLine(ja);
- //Console.ReadKey();
- #endregion
- #region zamiana
- //string t1 = "AA-1997-12-12-klej";
- //string t2 = "ZZZ-2004-11-23-farba";
- //string t11;
- //string t21;
- //t11 = t1.Substring(t1.IndexOf("-") + 1, 10);
- //t21 = t2.Substring(t2.IndexOf("-") + 1, 10);
- //Console.WriteLine(t11);
- //Console.WriteLine(t21);
- //Console.ReadKey();
- #endregion
- #region 4
- byte ile;
- Console.WriteLine("ile osób będzie?");
- ile = Convert.ToByte(Console.ReadLine());
- int i = 0;
- string[,] tab = new string[ile, 2];
- do
- {
- Console.WriteLine("podaj nazwisko");
- tab[i, 0] = Console.ReadLine();
- Console.WriteLine("podaj imię");
- tab[i, 1] = Console.ReadLine();
- i++;
- } while (i < ile);
- string kto;
- Console.WriteLine("Czyjego imienia szukasz?");
- kto = Console.ReadLine();
- for (i = 0; i < ile; i++)
- {
- if (tab[i, 0] == kto)
- {
- Console.WriteLine(tab[i, 1]);
- }
- }
- Console.ReadKey();
- #endregion
- }
- }
- }
Add Comment
Please, Sign In to add comment