add all
This commit is contained in:
parent
2d4a6268ed
commit
0a4bfa2299
BIN
.vs/ProjectEvaluation/lab1_pp.metadata.v9.bin
Normal file
BIN
.vs/ProjectEvaluation/lab1_pp.metadata.v9.bin
Normal file
Binary file not shown.
BIN
.vs/ProjectEvaluation/lab1_pp.projects.v9.bin
Normal file
BIN
.vs/ProjectEvaluation/lab1_pp.projects.v9.bin
Normal file
Binary file not shown.
BIN
.vs/ProjectEvaluation/lab1_pp.strings.v9.bin
Normal file
BIN
.vs/ProjectEvaluation/lab1_pp.strings.v9.bin
Normal file
Binary file not shown.
BIN
.vs/lab1_PP/DesignTimeBuild/.dtbcache.v2
Normal file
BIN
.vs/lab1_PP/DesignTimeBuild/.dtbcache.v2
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.vs/lab1_PP/v17/.futdcache.v2
Normal file
BIN
.vs/lab1_PP/v17/.futdcache.v2
Normal file
Binary file not shown.
BIN
.vs/lab1_PP/v17/.suo
Normal file
BIN
.vs/lab1_PP/v17/.suo
Normal file
Binary file not shown.
54
.vs/lab1_PP/v17/DocumentLayout.backup.json
Normal file
54
.vs/lab1_PP/v17/DocumentLayout.backup.json
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"Version": 1,
|
||||||
|
"WorkspaceRootPath": "C:\\Users\\student.DESKTOP-N01B4AU\\Desktop\\PP\\lab1_PP\\",
|
||||||
|
"Documents": [
|
||||||
|
{
|
||||||
|
"AbsoluteMoniker": "D:0:0:{F9463B85-2F8C-4E78-8131-04D0E9914962}|lab1_PP\\lab1_PP.csproj|c:\\users\\student.desktop-n01b4au\\desktop\\pp\\lab1_pp\\lab1_pp\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||||
|
"RelativeMoniker": "D:0:0:{F9463B85-2F8C-4E78-8131-04D0E9914962}|lab1_PP\\lab1_PP.csproj|solutionrelative:lab1_pp\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"AbsoluteMoniker": "D:0:0:{F9463B85-2F8C-4E78-8131-04D0E9914962}|lab1_PP\\lab1_PP.csproj|c:\\users\\student.desktop-n01b4au\\desktop\\pp\\lab1_pp\\lab1_pp\\highscore.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||||
|
"RelativeMoniker": "D:0:0:{F9463B85-2F8C-4E78-8131-04D0E9914962}|lab1_PP\\lab1_PP.csproj|solutionrelative:lab1_pp\\highscore.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"DocumentGroupContainers": [
|
||||||
|
{
|
||||||
|
"Orientation": 0,
|
||||||
|
"VerticalTabListWidth": 256,
|
||||||
|
"DocumentGroups": [
|
||||||
|
{
|
||||||
|
"DockedWidth": 200,
|
||||||
|
"SelectedChildIndex": 1,
|
||||||
|
"Children": [
|
||||||
|
{
|
||||||
|
"$type": "Document",
|
||||||
|
"DocumentIndex": 1,
|
||||||
|
"Title": "HighScore.cs",
|
||||||
|
"DocumentMoniker": "C:\\Users\\student.DESKTOP-N01B4AU\\Desktop\\PP\\lab1_PP\\lab1_PP\\HighScore.cs",
|
||||||
|
"RelativeDocumentMoniker": "lab1_PP\\HighScore.cs",
|
||||||
|
"ToolTip": "C:\\Users\\student.DESKTOP-N01B4AU\\Desktop\\PP\\lab1_PP\\lab1_PP\\HighScore.cs",
|
||||||
|
"RelativeToolTip": "lab1_PP\\HighScore.cs",
|
||||||
|
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAA==",
|
||||||
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
|
"WhenOpened": "2024-10-10T14:37:28.479Z",
|
||||||
|
"EditorCaption": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Document",
|
||||||
|
"DocumentIndex": 0,
|
||||||
|
"Title": "Program.cs",
|
||||||
|
"DocumentMoniker": "C:\\Users\\student.DESKTOP-N01B4AU\\Desktop\\PP\\lab1_PP\\lab1_PP\\Program.cs",
|
||||||
|
"RelativeDocumentMoniker": "lab1_PP\\Program.cs",
|
||||||
|
"ToolTip": "C:\\Users\\student.DESKTOP-N01B4AU\\Desktop\\PP\\lab1_PP\\lab1_PP\\Program.cs",
|
||||||
|
"RelativeToolTip": "lab1_PP\\Program.cs",
|
||||||
|
"ViewState": "AgIAACoAAAAAAAAAAAAAAEAAAAA8AAAAAAAAAA==",
|
||||||
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
|
"WhenOpened": "2024-10-10T14:03:27.833Z",
|
||||||
|
"EditorCaption": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
54
.vs/lab1_PP/v17/DocumentLayout.json
Normal file
54
.vs/lab1_PP/v17/DocumentLayout.json
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"Version": 1,
|
||||||
|
"WorkspaceRootPath": "C:\\Users\\student.DESKTOP-N01B4AU\\Desktop\\PP\\lab1_PP\\",
|
||||||
|
"Documents": [
|
||||||
|
{
|
||||||
|
"AbsoluteMoniker": "D:0:0:{F9463B85-2F8C-4E78-8131-04D0E9914962}|lab1_PP\\lab1_PP.csproj|c:\\users\\student.desktop-n01b4au\\desktop\\pp\\lab1_pp\\lab1_pp\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||||
|
"RelativeMoniker": "D:0:0:{F9463B85-2F8C-4E78-8131-04D0E9914962}|lab1_PP\\lab1_PP.csproj|solutionrelative:lab1_pp\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"AbsoluteMoniker": "D:0:0:{F9463B85-2F8C-4E78-8131-04D0E9914962}|lab1_PP\\lab1_PP.csproj|c:\\users\\student.desktop-n01b4au\\desktop\\pp\\lab1_pp\\lab1_pp\\highscore.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||||
|
"RelativeMoniker": "D:0:0:{F9463B85-2F8C-4E78-8131-04D0E9914962}|lab1_PP\\lab1_PP.csproj|solutionrelative:lab1_pp\\highscore.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"DocumentGroupContainers": [
|
||||||
|
{
|
||||||
|
"Orientation": 0,
|
||||||
|
"VerticalTabListWidth": 256,
|
||||||
|
"DocumentGroups": [
|
||||||
|
{
|
||||||
|
"DockedWidth": 200,
|
||||||
|
"SelectedChildIndex": 1,
|
||||||
|
"Children": [
|
||||||
|
{
|
||||||
|
"$type": "Document",
|
||||||
|
"DocumentIndex": 1,
|
||||||
|
"Title": "HighScore.cs",
|
||||||
|
"DocumentMoniker": "C:\\Users\\student.DESKTOP-N01B4AU\\Desktop\\PP\\lab1_PP\\lab1_PP\\HighScore.cs",
|
||||||
|
"RelativeDocumentMoniker": "lab1_PP\\HighScore.cs",
|
||||||
|
"ToolTip": "C:\\Users\\student.DESKTOP-N01B4AU\\Desktop\\PP\\lab1_PP\\lab1_PP\\HighScore.cs",
|
||||||
|
"RelativeToolTip": "lab1_PP\\HighScore.cs",
|
||||||
|
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAA==",
|
||||||
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
|
"WhenOpened": "2024-10-10T14:37:28.479Z",
|
||||||
|
"EditorCaption": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Document",
|
||||||
|
"DocumentIndex": 0,
|
||||||
|
"Title": "Program.cs",
|
||||||
|
"DocumentMoniker": "C:\\Users\\student.DESKTOP-N01B4AU\\Desktop\\PP\\lab1_PP\\lab1_PP\\Program.cs",
|
||||||
|
"RelativeDocumentMoniker": "lab1_PP\\Program.cs",
|
||||||
|
"ToolTip": "C:\\Users\\student.DESKTOP-N01B4AU\\Desktop\\PP\\lab1_PP\\lab1_PP\\Program.cs",
|
||||||
|
"RelativeToolTip": "lab1_PP\\Program.cs",
|
||||||
|
"ViewState": "AgIAACoAAAAAAAAAAAAAAEAAAAA8AAAAAAAAAA==",
|
||||||
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
|
"WhenOpened": "2024-10-10T14:03:27.833Z",
|
||||||
|
"EditorCaption": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
25
lab1_PP.sln
Normal file
25
lab1_PP.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.11.35312.102
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab1_PP", "lab1_PP\lab1_PP.csproj", "{F9463B85-2F8C-4E78-8131-04D0E9914962}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{F9463B85-2F8C-4E78-8131-04D0E9914962}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F9463B85-2F8C-4E78-8131-04D0E9914962}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F9463B85-2F8C-4E78-8131-04D0E9914962}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F9463B85-2F8C-4E78-8131-04D0E9914962}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {86C4EC80-575C-433B-96A1-97EF9F3683D3}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
15
lab1_PP/HighScore.cs
Normal file
15
lab1_PP/HighScore.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace lab1_PP
|
||||||
|
{
|
||||||
|
internal class HighScore
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public int Trials { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
66
lab1_PP/Program.cs
Normal file
66
lab1_PP/Program.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
//zadanie 1.3.
|
||||||
|
using lab1_PP;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
Console.WriteLine("zadanie 1.3.");
|
||||||
|
for (int i = 1; i <= 100; i++)
|
||||||
|
{
|
||||||
|
if(i%3==0 && i % 5 == 0) { Console.WriteLine("FizzBuzz"); }
|
||||||
|
else if(i%3==0) { Console.WriteLine("Fizz"); }
|
||||||
|
else if(i%5==0) { Console.WriteLine("Buzz"); }
|
||||||
|
else { Console.WriteLine(i); }
|
||||||
|
}
|
||||||
|
|
||||||
|
//zadanie 1.3.
|
||||||
|
Console.WriteLine("zadanie 1.3.");
|
||||||
|
var rand = new Random();
|
||||||
|
var value = rand.Next(1, 101);
|
||||||
|
int guess = 0;
|
||||||
|
bool validInput = false;
|
||||||
|
int trials = 0;
|
||||||
|
while (guess != value)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Wprowadź wartość: ");
|
||||||
|
validInput = int.TryParse(Console.ReadLine(), out guess);
|
||||||
|
if (!validInput)
|
||||||
|
{
|
||||||
|
Console.WriteLine("To nie jest poprawna liczba. Spróbuj ponownie.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guess > value)
|
||||||
|
{
|
||||||
|
trials++;
|
||||||
|
Console.WriteLine("Za dużo");
|
||||||
|
}
|
||||||
|
else if (guess < value)
|
||||||
|
{
|
||||||
|
trials++;
|
||||||
|
Console.WriteLine("Za mało");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trials++;
|
||||||
|
Console.WriteLine("Wygrana w "+trials+" probie!");
|
||||||
|
string name;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Console.WriteLine("Podaj swoje imię:");
|
||||||
|
name = Console.ReadLine();
|
||||||
|
} while (string.IsNullOrWhiteSpace(name));
|
||||||
|
|
||||||
|
//zapisanie do listy i utworzenie pliku jesli nie istnieje
|
||||||
|
List<HighScore> highScores;
|
||||||
|
const string FileName = "highscores.json";
|
||||||
|
if (File.Exists(FileName))
|
||||||
|
highScores = JsonSerializer.Deserialize<List<HighScore>>(File.ReadAllText(FileName));
|
||||||
|
else
|
||||||
|
highScores = new List<HighScore>();
|
||||||
|
|
||||||
|
var hs = new HighScore { Name = name, Trials = trials };
|
||||||
|
highScores.Add(hs);
|
||||||
|
File.WriteAllText(FileName,JsonSerializer.Serialize(highScores));
|
||||||
|
foreach (var item in highScores.OrderBy(h => h.Trials))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{item.Name} -- {item.Trials} prób");
|
||||||
|
}
|
10
lab1_PP/lab1_PP.csproj
Normal file
10
lab1_PP/lab1_PP.csproj
Normal file
@ -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…
Reference in New Issue
Block a user