Skip to content

Instantly share code, notes, and snippets.

View Strelok78's full-sized avatar

Shota Strelok78

View GitHub Profile
@Strelok78
Strelok78 / Shuffle array elements
Last active May 17, 2023 06:49
Implementation of the Shuffle function, which shuffles the array elements in random order.
using System.Diagnostics;
internal class Program
{
static void Main(string[] args)
{
int[] arrayInts = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
string[] arrayStrings = { "string1", "string2", "string3", "string4", "string5", "string6", "string7", "string8", "string9" };
ShuffleArray(arrayInts);
@Strelok78
Strelok78 / Dictionary
Last active May 17, 2023 07:17
Accepts a word from the user and outputs its meaning. If there is no such word, it displays the corresponding message.
internal class Program
{
public static void Main()
{
string enteredText;
string returnedValue;
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
keyValuePairs.Add("aaa", "sss");
keyValuePairs.Add("bbb", "rrr");
@Strelok78
Strelok78 / Queue at the store
Last active May 17, 2023 07:20
Each integer is the purchase amount. After each customer is served, money is added to the account and displayed in the console.
using System.Diagnostics;
internal class Program
{
public static void Main()
{
int companyBalance = 0;
Queue<int> queue = new Queue<int>();
queue.Enqueue(14);
@Strelok78
Strelok78 / Advanced dynamic array (collection List)
Last active May 17, 2023 07:22
The user enters the numbers, and the program remembers them. As soon as the user enters the "sum" command, the program outputs the sum of all the entered numbers. Exit the program if the user enters the "exit" command.
using System.Diagnostics;
internal class Program
{
public static void Main()
{
const string CommandSum = "sum";
const string CommandExit = "exit";
string enteredText;
@Strelok78
Strelok78 / Advanced Personnel accounting
Last active May 17, 2023 07:36
Personnel accounting using Dictionary
using System.ComponentModel.Design;
namespace iJuniorRefactoring
{
internal class Program
{
public static void Main()
{
const string CommandAdd = "1";
const string CommandShowEmployees = "2";
@Strelok78
Strelok78 / Merging into a single collection
Last active May 17, 2023 07:41
Combining strings arrays without using LINQ and avoiding repeats
//Есть два массива строк. Надо их объединить в одну коллекцию,
//исключив повторения, не используя Linq. Пример: {"1", "2", "1"} + {"3", "2"} => {"1", "2", "3"}
internal class Program
{
public static void Main()
{
string[] arrayNumbers = { "1", "2", "3", "4", "5", "6", "8", "8", "2" };
string[] arrayOddNumbers = { "1", "3", "5", "7", "9" };
@Strelok78
Strelok78 / Practicing with classes
Last active May 17, 2023 07:42
Player class, with fields containing information about the player and a method that displays the information on the screen.
internal class Program
{
public static void Main()
{
Console.WriteLine("Enter Players' name");
string name = Console.ReadLine();
Console.WriteLine("Enter Players' age");
int age = int.Parse(Console.ReadLine());
@Strelok78
Strelok78 / Practicing with properties
Last active May 17, 2023 07:46
A player class that has properties with its position (x, y). A renderer class, with a method that renders the player.
internal class Program
{
public static void Main()
{
char hero = '@';
int xPosition = 20;
int yPosition = 20;
Renderer renderer = new Renderer();
Player player = new Player(xPosition, yPosition);
@Strelok78
Strelok78 / Player database
Last active May 17, 2023 07:48
The player has a unique number, nickname, level, flag. It is possible to add a player, ban a player by a unique number, unban a player by a unique number and delete a player.
internal class Program
{
public static void Main()
{
Database data = new Database();
data.ShowMenu();
}
}
class Database
@Strelok78
Strelok78 / Card deck
Last active June 13, 2025 19:11
There is a deck with cards. The player takes out the cards until he decides that he has enough cards. After that, all information about the drawn cards is displayed.
internal class Program
{
public static void Main()
{
Player player = new Player();
player.ShowMenu();
}
}