Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,4 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml
/kalkulator/kalkulator.csproj
124 changes: 66 additions & 58 deletions AppsLab.CSharp.Exercises.sln

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions ConsoleApp1/ConsoleApp1.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36518.9 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{B0D2C785-961A-4C25-85E4-E5DF4F354431}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B0D2C785-961A-4C25-85E4-E5DF4F354431}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0D2C785-961A-4C25-85E4-E5DF4F354431}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0D2C785-961A-4C25-85E4-E5DF4F354431}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0D2C785-961A-4C25-85E4-E5DF4F354431}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4D998F3B-ABBE-48D1-80A5-63D150FDE9B1}
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
2 changes: 2 additions & 0 deletions ConsoleApp1/ConsoleApp1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
11 changes: 11 additions & 0 deletions ConsoleApp2/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class citac
{
private const string _fileName = "C:\Users\NTB\OneDrive\Počítač\prax.txt";

public int CountWords()
{
string text = File.ReadAllText(_fileName);
string[] words = text.Split(' '11);
return words.Length;
}
}
1 change: 1 addition & 0 deletions ConsoleApp2/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

10 changes: 10 additions & 0 deletions ConsoleApp2/citac slov.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
22 changes: 22 additions & 0 deletions hra kockova/FileProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace uhadni
{
internal class FileProvider
{
public int LoadMaxNumber(string filename)
{
string fileContent = File.ReadAllText(filename);


int maxnumber = Convert.ToInt32(fileContent);
return maxnumber;
}

}
}

19 changes: 19 additions & 0 deletions hra kockova/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using uhadni;

Engine engine = new Engine();
Console.WriteLine("pokracuj stlacenim klavesi");

while (Console.ReadKey(true).Key != ConsoleKey.Escape)
{

FileProvider myFileProvider = new FileProvider();

int maxNumber = myFileProvider.LoadMaxNumber("C:\\Users\\NTB\\OneDrive\\Dokumenty\\prax\\numberguess.txt");
Randomizer myRandomizer = new Randomizer(maxNumber);
int randomNumber = myRandomizer.Random();



engine.Do(randomNumber);
Console.WriteLine("pokracuj stlacenim klavesiy , ESC ukončíš program");
}
28 changes: 28 additions & 0 deletions hra kockova/Randomizer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace uhadni
{
internal class Randomizer
{

private int MaxNumber;
private Random Rnd;

public Randomizer(int maxNumber)
{
Rnd = new Random();
MaxNumber = maxNumber;
}
public int Random()

{
Random rnd = new Random();
int nextNumber = rnd.Next(MaxNumber);
return nextNumber;
}
}
}
46 changes: 46 additions & 0 deletions hra kockova/engine.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace uhadni
{
internal class Engine
{
private int ReadUserInput()
{
while (true)
{
string userInput = Console.ReadLine();
if (int.TryParse(userInput, out int value))
{
return value;
}
Console.WriteLine("Nevieš čo je číslo???");
}
}

public void Do(int randomNumber)
{
Console.WriteLine("Zadaj tvoj tip");

int guess = ReadUserInput();

while (guess != randomNumber)
{
if (guess > randomNumber)
{
Console.WriteLine("Skús menšie");
}
else if (guess < randomNumber)
{
Console.WriteLine("Skús väčšie");
}
guess = ReadUserInput();
}
Console.WriteLine("Gratulujem uhadol si");
}
}
}
11 changes: 11 additions & 0 deletions hra kockova/uhadni cislo.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>hra_kockova</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
30 changes: 30 additions & 0 deletions hra/Monster.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using ConsoleApp1;

namespace ConsoleApp1
{
public class Monster
{
private const int maxHP = 200;
private const int minHP = 0;

private int currentHP = maxHP;
private int Monsterdamage = 1;

public Monster(string? monstername)
{
}

public bool DealDamage(Player opponent)
{
opponent.Takedamage(Monsterdamage);
return true;
}

internal void Takedamage(int damage)
{
currentHP -= damage;
}
}
}


32 changes: 32 additions & 0 deletions hra/Player.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@


using System.ComponentModel;

namespace ConsoleApp1
{
public class Player
{
private const int maxHP = 100;
private const int minHP = 0;

private int currentHP = maxHP;
private int damage = 25;
List<string> inventory = new List<string>();
private string Name;
internal void SetName(string? playername)
{
Name = playername;
}

public bool DealDamage(Monster opponent)
{
opponent.Takedamage(damage);
return true;
}

internal void Takedamage(int damage)
{
currentHP -= damage;
}
}
}
21 changes: 21 additions & 0 deletions hra/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using ConsoleApp1;

Console.WriteLine("Zadaj meno hráčovy");
string playername = Console.ReadLine();
Console.WriteLine("Zadaj meno príšeri");
string monstername = Console.ReadLine();


Player player = new Player();
player.SetName(playername);

Monster monster = new Monster(monstername);

player.DealDamage(monster);

Console.WriteLine();

monster.DealDamage(player);

Console.WriteLine();

10 changes: 10 additions & 0 deletions hra/hra.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
Empty file added kalkulator/NewFile
Empty file.
78 changes: 78 additions & 0 deletions kalkulator/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//using System.Numerics;
//{
// int a = 20;
// int b = 5;

// int sum = a + b;
// int differenc = a - b;
// int product = a * b;
// int division = a / b;
// int remainder = a % b;

// bool rovnost = a == b;
// bool nerovnost = a != b;
// bool väčšíako = a > b;
// bool menšíako = a < b;
// bool väčšíaleborovnýako = a >= b;
// bool menšíaleborovnýako = a <= b;
//}

//using System.Numerics;

//bool a = true;
//bool b = 74;
//bool c = 42;

//bool andBool1 = a && (b > c);
//bool andBool2 = a && (b==c);
//bool andBool3 = a && (b == c) || (c < b);
//bool andBool4 = a && ((b ==c) || (c < b));
//int d = 0;


//načitam si cislo s klavesnice

//ak je to 6-vypis ides este raz

//int age = 20;

//if (age <= 18) ;
//{
// Console.WriteLine("Som dospely ");
// Console.WriteLine("Dam si pivo");
//}

//Console.WriteLine("Hoď kockou");
//string s = Console.ReadLine();

//int cislo = int.Parse(s);

//if (cislo >= 1 && cislo <= 6);
//{
// Console.WriteLine("Hurá hodil si kockou");
//}

Console.WriteLine("Zadaj prvé cislo");
int cislo1 = int .Parse(Console.ReadLine());
Console.WriteLine("WOW super");
Console.WriteLine("Zadaj druhe cislo");
int cislo2 = int .Parse(Console.ReadLine());

int sucet = cislo1 + cislo2;
Console.WriteLine($"Sucet {sucet}");
int rozdiel = cislo1 - cislo2;
Console.WriteLine($"Rozdiel{rozdiel}");
int sucin = cislo1 * cislo2;
Console.WriteLine($"sucin{sucin}");
int podiel = cislo1 / cislo2;











1 change: 1 addition & 0 deletions numberguess.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
271
4 changes: 4 additions & 0 deletions quiz/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Console.WriteLine("Vítaj v mojom kvíze");
Console.WriteLine("Poďme teda na to");
Console.WriteLine("Prvá otázka kolko mam rokov ");

10 changes: 10 additions & 0 deletions quiz/quiz.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
Loading