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
32 changes: 17 additions & 15 deletions AppsLab.CSharp.Exercises.sln
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-033-NuGet", "src\Ap
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-034-Debug", "src\AppsLab-034-Debug\AppsLab-034-Debug.csproj", "{83C963FD-DC23-46E8-9545-F56197164810}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "One time next time", "One time next time\One time next time.csproj", "{3123B492-291E-48B6-862B-0433E039DCA4}"
EndProject
Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -226,18 +225,6 @@ Global
{A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x64.Build.0 = Release|Any CPU
{A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x86.ActiveCfg = Release|Any CPU
{A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x86.Build.0 = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x64.ActiveCfg = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x64.Build.0 = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x86.ActiveCfg = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x86.Build.0 = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|Any CPU.Build.0 = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x64.ActiveCfg = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x64.Build.0 = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x86.ActiveCfg = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x86.Build.0 = Release|Any CPU
{FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -634,6 +621,21 @@ Global
{83C963FD-DC23-46E8-9545-F56197164810}.Release|x64.Build.0 = Release|Any CPU
{83C963FD-DC23-46E8-9545-F56197164810}.Release|x86.ActiveCfg = Release|Any CPU
{83C963FD-DC23-46E8-9545-F56197164810}.Release|x86.Build.0 = Release|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Debug|x64.ActiveCfg = Debug|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Debug|x64.Build.0 = Debug|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Debug|x86.ActiveCfg = Debug|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Debug|x86.Build.0 = Debug|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Release|Any CPU.Build.0 = Release|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Release|x64.ActiveCfg = Release|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Release|x64.Build.0 = Release|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Release|x86.ActiveCfg = Release|Any CPU
{3123B492-291E-48B6-862B-0433E039DCA4}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{57860CA2-0054-465E-BD1E-024FF8D81354} = {56555FB0-B513-49EF-9002-A5AF135EA090}
Expand Down
11 changes: 11 additions & 0 deletions One time next time/One time next time.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>One_time_next_time</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
169 changes: 169 additions & 0 deletions One time next time/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
//Console.WriteLine("Zadaj den v tyzdni (1-7): ");
//int dayOfWeek = int.Parse(Console.ReadLine()!);
//{
// switch (dayOfWeek)
// {
// case 1:
// Console.WriteLine("Pondelok");
// break;
// case 2:
// Console.WriteLine("Utorok");
// break;
// case 3:
// Console.WriteLine("Streda");
// break;
// case 4:
// Console.WriteLine("Stvrtok");
// break;
// case 5:
// Console.WriteLine("Piatok");
// break;
// case 6:
// Console.WriteLine("Sobota");
// break;
// case 7:
// Console.WriteLine("Nedela");
// break;
// default:
// Console.WriteLine("Neplatny den v tyzdni");
// break;

// }
//}
//int number = 5;
//string result = number switch
//{
// 1 => "One",
// 2 => "Two",
// 3 => "Three",
// 4 => "Four",
// 5 => "Five",
// _ => "Unknown"
//};
//Console.WriteLine(result);





//for (int i = 1; i <= 1000; i++)
//{
// int modulo = i % 2;
//if (modulo == 0)
//{
// Console.WriteLine(i);
//}
//}

//int[] numbers = new int[5] { 10, 100, 80, 150, 2000 };


//for (int i = 0; i < 5; i++)
//{
// Console.WriteLine(numbers[i]);
//}

//string[,] matrix = new string[30, 5];
//// vloz 4 roznych mien
//// vypis cele pole na obrayovku
//matrix[0, 2] = "Ferko";
//matrix[1, 2] = "Janko";
//matrix[25, 4] = "Misko";

//for (int i = 0; i < 30; i++)
//{
// for (int j = 0; j < 5; j++)
// {
// Console.Write(matrix[i, j] + ", ");
// }
// Console.WriteLine();
// }


//Console.WriteLine("*");
//Console.WriteLine("**");
//Console.WriteLine("***");
//Console.WriteLine("****");
//Console.WriteLine("*****");
//Console.WriteLine("*****");
//Console.WriteLine("****");
//Console.WriteLine("***");
//Console.WriteLine("**");
//Console.WriteLine("*");


//string s = "*";
//while (s.Length < 5)
//{
// Console.WriteLine(s);
// s += "*";

//}
//while (s.Length > 0)
//{


//using System.Globalization;

//int[] pole = new int[10] { 50, 60, 75, 98, 23, 45, 67, 98, 11, 5 };
//int i = 0;
//int vysledok = 0;
//for ( i = 0; i < pole.Length; i++)
//{
// vysledok += pole[i];


//}
//Console.WriteLine(vysledok);

//string[] names = { "Dnes", "sa", "mam", "dobre" };
//foreach (string name in names)
//{
// Console.Write($"{name} ");
//}

// spravim zoznam
//using System.Globalization;

//List<int> cisla = new List<int>();
//Console.WriteLine("Zadaj cislo");
//string vstup = Console.ReadLine();

//while (vstup != "+")
//{
// cisla.Add(int.Parse(vstup));
// Console.WriteLine("Zadaj cislo");
// vstup = Console.ReadLine();
// }

//Console.WriteLine("Vysledok scitania:");
//int sucet = 0;
//foreach (int i in cisla)
//{
// sucet += i;
//}
//Console.WriteLine(sucet);

// zadam svoje meno a vek a privita ma to ahoj
string meno = ZiskajMeno();
int vek = ZiskajVek();
VypisUdaje(meno, vek);
string ZiskajMeno()
{
Console.WriteLine("Zadaj svoje meno: ");
string meno = Console.ReadLine()!;
return meno;
}

int ZiskajVek()
{
Console.WriteLine("Zadaj svoj vek: ");
int vek = int.Parse(Console.ReadLine());
return vek;
}
void VypisUdaje(string meno, int vek)
{
Console.WriteLine($"Ahoj, {meno} tvoj vek je {vek}");
}


2 changes: 1 addition & 1 deletion src/AppsLab-001-StartHere/Greetings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public class Greetings
/// <returns>A string containing the greeting message.</returns>
public string Hello()
{
return "Hello World!";
return "Hello AppsLab!";
}
}
14 changes: 13 additions & 1 deletion src/AppsLab-002-ConsoleWriteLine/Program.cs
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
Console.WriteLine("Hello, World!");

int age = 15;
string name = "Michal";


Console.WriteLine($"My name is {name} and I am {age}");




Console.WriteLine(MaxPoints);
Console.WriteLine(MinAgeForDriversLicense);
Console.WriteLine(WelcomeMessange);
41 changes: 39 additions & 2 deletions src/AppsLab-005-DataTypes/Program.cs
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
int mojeCislo = 1234;
string mojeSlovo = "Ahoj kamarádi";
bool mojaBoolhodnota = true;
float myFloat = 2.5f;
var noveCislo = 255;
DateTime dnesnyDatum = DateTime.Now;
const int MaxStudents = 15
int sucet = mojeCislo + 10;
Console.WriteLine(mojeCislo.ToString("00000"));
Console.WriteLine(mojeSlovo);
Console.WriteLine($"Súčet je: {sucet}");
Console.WriteLine($"Dnes je: {dnesnyDatum.ToString ("yyyy-MM-dd")}");
Console.WriteLine($"Bool hodnota je: {mojaBoolhodnota}");
Console.WriteLine(myFloat);
Console.WriteLine(noveCislo);
Console.WriteLine("Maximalny pocet studentov je: " + MaxStudents);


Console.WriteLine("Ako sa voláš?");
string? meno = Console.ReadLine();
Console.WriteLine($"Ahoj, {meno}! Kolko mas rokov?");
string vstup = Console.ReadLine() ?? "0";
int vek = int.Parse(vstup);
Console.WriteLine("Aha, mas teda 15 rokov");
Console.WriteLine("Ake je tvoje oblubene jedlo ?");
string jedlo = Console.ReadLine() ?? "0";
Console.WriteLine($"Hmm, {jedlo} znie skvele!");
Console.WriteLine("Daj mi vsetky peniaze co mas!");
string text = Console.ReadLine() ?? "0";
Console.WriteLine("Nevadi tak nabuduce!");
Console.WriteLine("Stlac klavesu: ");
var key = Console.ReadKey();
Console.WriteLine();
Console.WriteLine($"Stlacili ste klavesu: {key.KeyChar}");





8 changes: 6 additions & 2 deletions src/AppsLab-006-Constants/Program.cs
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
const int MaxPoints = 100;
const int MinAgeForDriversLicense = 17;
const string WelcomeMessange = "Vitajte v nasej hre!";
Console.WriteLine($"Maximalny pocet bodov v hre je {MaxPoints}");
Console.WriteLine($"Minimalny vek na vodicky preukaz je {MinAgeForDriversLicense}");
Console.WriteLine(WelcomeMessange);
21 changes: 14 additions & 7 deletions src/AppsLab-007-Casting/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,61 @@ public class Converter
/// </summary>
public double IntToDouble(int number)
{
throw new NotImplementedException();
return Convert.ToDouble(number);

}

/// <summary>
/// This method converts a double to an integer.
/// </summary>
public int DoubleToInt(double number)
{
throw new NotImplementedException();
return Convert.ToInt32(number);

}

/// <summary>
/// This method converts a string to a double.
/// </summary>
public double StringToDouble(string number)
{
throw new NotImplementedException();
return Convert.ToDouble(number);

}

/// <summary>
/// This method converts a double to a string.
/// </summary>
public string DoubleToString(double number)
{
throw new NotImplementedException();
return Convert.ToString(number);

}

/// <summary>
/// This method converts a string to a boolean.
/// </summary>
public string IntToString(int number)
{
throw new NotImplementedException();
return Convert.ToString(number);

}

/// <summary>
/// This method converts a boolean to a string.
/// </summary>
public bool StringToBool(string boolValue)
{
throw new NotImplementedException();
return Convert.ToBoolean(boolValue);

}

/// <summary>
/// This method converts a boolean to a string.
/// </summary>
public string BoolToString(bool boolValue)
{
throw new NotImplementedException();
return Convert.ToString(boolValue);

}
}
Loading