using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/*
Komentarz blokowy
*/
//komentarz liniowy
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Wybierz zadanie: 1,2,4,5,cw9 lub wpisz 'exit'.");
string mode = Console.ReadLine();
while (mode != "exit")
{
Console.Clear();
switch (mode)
{
case "1":
//Console.WriteLine("Podaj swoje imię");
//string imie = Console.ReadLine();
//Console.WriteLine("Cześć, " + imie);
//Console.WriteLine("\nWciśnij dowolny przycisk...");
//Console.ReadKey();
//Console.Clear();
Console.WriteLine("Podaj swój wiek");
//int wiek = int.Parse(Console.ReadLine());
string wiek = Console.ReadLine();
Console.WriteLine("Masz " + wiek + " lat");
break;
case "2":
Console.WriteLine("\nPodaj liczby: ");
//int num1 = int.Parse(Console.ReadLine());
//Console.Write(" + ");
//int num2 = int.Parse(Console.ReadLine());
//Console.Write(" = " + (num1 + num2) + "\n\n");
//Console.WriteLine(" = " + (num1 + num2));
Console.Write("2 + 8 = " + (2 + 8) + "\n");
Console.Write("4 / 2 = " + (4 / 2) + "\n");
Console.Write("5 * 6 = " + (5 * 6) + "\n");
break;
case "4":
Console.WriteLine("Wpisz imie i nazwisko: ");
string imie = Console.ReadLine();
string nazwisko = Console.ReadLine();
Console.Clear();
Console.WriteLine("Zalogowany użytkownik: " + imie + " " + nazwisko);
break;
case "5":
string ciag = Console.ReadLine();
char[] znaki = new char[] { '•' };
int[] ilosc = new int[] { 0 };
Console.WriteLine("Proces przeglądu znaków: ");
for (int i = 0; i < ciag.Length; i++)
{
int index = Array.IndexOf(znaki, ciag[i]);
if (index != -1)
{
ilosc[index]++;
Console.WriteLine(" Zwiększam ilość literę '" + ciag[i] + "'...");
}
else
{
znaki = znaki.Concat(new char[] { ciag[i] }).ToArray();
ilosc = ilosc.Concat(new int[] { 1 }).ToArray();
//ilosc[index]++;
Console.WriteLine(" Dodaję literę '" + ciag[i] + "'...");
}
}
Console.WriteLine("\n\nStatystyki liter dla wyrazenia:\n(znaków: " + ciag.Length + ") " + ciag + "\n");
//if ('a' > 'b')
// Console.WriteLine("a");
//if ('a' < 'b')
// Console.WriteLine("b");
//if ('c' < 'b')
// Console.WriteLine("b");
//if ('c' > 'b')
// Console.WriteLine("c");
char pomZ;
int pomI, min;
for (int i = 0; i < znaki.Length; i++)
{
//for (var j = i + j;< A[min]; j++)
// min = j;
min = 0;
for (int j = i + 1; j < ilosci[min] ; j++)
{
min = j;
if (ilosc[i] < ilosc[i - 1])
{
pomZ = znaki[i];
pomI = ilosc[i];
znaki[i] = znaki[i + 1];
ilosc[i] = ilosc[i + 1];
znaki[i + 1] = pomZ;
ilosc[i + 1] = pomI;
}
}
}
for (int i = 1; i < znaki.Length; i++)
{
Console.WriteLine("• litera: '" + znaki[i] + "' - wystąpień: " + ilosc[i] + "");
}
break;
case "cw9":
int a, b;
a = 8;
b = 24;
Console.WriteLine(a + b);
Console.WriteLine(b % a); //reszta z dzielenia
Console.WriteLine(a % b);
Console.WriteLine();
Console.WriteLine(b++); //inkrementacja
Console.WriteLine(b);
Console.WriteLine(a-); //dekrementacja
Console.WriteLine(a);
Console.WriteLine(-b);
Console.WriteLine(b);
Console.WriteLine(++a);
Console.WriteLine(a);
Console.ReadKey();
break;
default:
Console.WriteLine("Niestety polecenia nie znaleziono...");
break;
}
Console.WriteLine("\n\nWciśnij dowolny przycisk...");
Console.ReadKey();
Console.Clear();
Console.WriteLine("Wybierz zadanie: 1,2,4,5,cw9 lub wpisz 'exit':");
mode = Console.ReadLine();
}
}
}
}
Czynności negatywnie wpływające na pracę strony i działające na niekorzyść, bądź wręcz szkodę użytkowników, są zabronione i będą karane!
Administrator strony nie bierze odpowiedzialności za dodawane treści
Wszystkie treści, zwłaszcza łamiące zasady dobrej etyki, mogą zostać zmoderowane w każdej chwili po uprzednim kontakcie z Administratorem
FAQ | Wykonał Piotr Greczka | Facebook twórcy (kontakt)