Add project files.

This commit is contained in:
István Priskin 2022-04-25 15:04:55 +02:00
parent 326c6953f6
commit e7383902bb
5 changed files with 159 additions and 0 deletions

25
Morze.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31624.102
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Morze", "Morze\Morze.csproj", "{5883F281-501E-40B1-8C10-6D0843690A88}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5883F281-501E-40B1-8C10-6D0843690A88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5883F281-501E-40B1-8C10-6D0843690A88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5883F281-501E-40B1-8C10-6D0843690A88}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5883F281-501E-40B1-8C10-6D0843690A88}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F46821C5-D008-456A-B856-63793B54324C}
EndGlobalSection
EndGlobal

8
Morze/Morze.csproj Normal file
View File

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>

64
Morze/Program.cs Normal file
View File

@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace Morze
{
class Program
{
static void Main(string[] args)
{
Dictionary<string, string> abc = new Dictionary<string, string>();
Dictionary<string, string> abcvissza = new Dictionary<string, string>();
string[] sorok = File.ReadAllLines(@"..\..\..\morzeabc.txt",System.Text.Encoding.UTF8);
for (int i = 1; i < sorok.Length; i++)
{
string[] t = sorok[i].Split('\t');
abc.Add(t[0], t[1]);
abcvissza.Add(t[1], t[0]);
}
Console.WriteLine("3. feladat: A morze abc {0} db karakter kódját tartalmazza",abc.Count);
Console.Write("4. feladat: Kérek egy karaktert: ");
string bekar = Console.ReadLine();
string kod;
abc.TryGetValue(bekar,out kod);
Console.WriteLine((kod==null)?"Nem található a kódtárban ilyen karakter!":$"A {bekar} karakter morze kódja: {kod}");
//5. feladat
string[] idezetek = File.ReadAllLines(@"..\..\..\morze.txt", System.Text.Encoding.UTF8);
Console.WriteLine("7. feladat: Az első idézet szerzője: "+Morze2Szöveg(idezetek[0].Split(" ;")[0],abcvissza));
string lhszerzo = "";
string lhidezet = "";
foreach (string id in idezetek)
{
string isz = Morze2Szöveg(id.Split(" ;")[1],abcvissza);
if (isz.Length>lhidezet.Length)
{
lhidezet = isz;
lhszerzo = Morze2Szöveg(id.Split(" ;")[0], abcvissza);
}
}
Console.WriteLine("8. feladat: A leghosszabb idézet szerzője és az idézet: "+lhszerzo+": "+lhidezet);
}
//6. feladat
static string Morze2Szöveg(string kodolva,Dictionary<string,string> vabc)
{
string szoveg = "";
string[] szavak = kodolva.Split(" ");
foreach (string szo in szavak)
{
string[] kodok = szo.Split(" ");
foreach (string k in kodok)
{
string betu = vabc[k];
szoveg += betu;
}
szoveg += " ";
}
return szoveg;
}
}
}

18
Morze/morze.txt Normal file
View File

@ -0,0 +1,18 @@
.- .-. .. ... --.. - --- - . .-.. ..-.. ... --.. ;.- -... .- .-. .--.- - ... .--.- --. .- --.. --..-- .- -- .. -.- --- .-. . --. -.-- .-.. ..-.. .-.. . -.- -.- ..-.. - - . ... - -... . -. .-.. .- -.- .. -.- .-.-.-
--. .-. .- ..-. ..-. .. - .. ;-. . .- --. --. --- -.. .--- .- --.. . --. ..-.. ... --.. ... ..-.. --. . -.. -- .. .- - - --.-- . .-.. -- ..- .-.. .. -.- .-.-.-
.-.. . --- -. .- .-. -.. -.-. --- .... . -. ;.--- .--.- .-. --- -.. .- --.. ..- - .- -.. --..-- .--- .--.- .-. --- -- .- --.. ..- - .- -.. ..-.. -. .. ... .-.-.-
-.- --- ... --.. - --- .-.. .--.- -. -.-- .. -.. . --.. ... --- ;-.-. ... .- .-.. --- -.. -. .. -.-. ... .- -.- .- --.. - ..- -.. --..-- .- -.- .. ...- .- .-.. .- .... .- .... .. - - .-.-.-
. .-. -. . ... - .... . -- .. -. --. .-- .- -.-- ;-- . --. ..-.. .-. - . -. .. .- -. -. -.-- .. --..-- -- .. -. - -- . --. -... --- -.-. ... .--.- - .- -. .. .-.-.-
..-. .-. .- -. -.-. --- .. ... -- .- ..- .-. .. .- -.-. ;.- ..-. ..-.. .-.. . .-.. . -- .- -... ---. .-.. -.-. ... . ... ... ..-.. --. -.- . --.. -.. . - . .-.-.-
..-. .-. .- -. -.- .... . .-. -... . .-. - ;.... .- -. . -- .... .- .--- .-.. ..- -. -.- --..-- .- -.- -.- --- .-. . .-.. - ---. .-. .... . - ..-- -. -.- .-.-.-
.-. .- .- -. .- .-. .- .- ... ;-. . -- .- -.-. ..-.. .-.. .- ..-. --- -. - --- ... --..-- .... .- -. . -- .- --.. ..- - .-.-.-
--. ..- .. .-.. .-.. .- ..- -- . -- ..- ... ... --- ;- ..- -.. -. .. -.- . .-.. .-.. -- . --. -... --- -.-. ... .--.- - .- -. .. ..-.. ... ..-. . .-.. . .--- - . -. .. .-.-.-
..-. .-. .. . -.. .-. .. -.-. .... -. .. . - --.. ... -.-. .... . ;--.. . -. . -. ..-.. .-.. -.- ..-- .-.. .- --.. ..-.. .-.. . - - ..-.. ...- . -.. ..-.. ... ...- --- .-.. -. .- .-.-.-
.--. --- .--. .--. . .-. .--. ..-.. - . .-. ;---. -. - ..- -.. .- - .-.. .- -. ..- .-.. . .-.. -.- ---. ...- . - . - - -... ..- -. -. .. -. -.-. ... .-.-.-
... - . .--. .... . -. -.- .. -. --. ;.- ... --.. . .-. . - . - -. . -- .. ... -- . .-. .- -.- .- -.. .--.- .-.. -.-- - .-.-.-
...- --- .-.. - .- .. .-. . ;-- .. -. -.. . -. -- ..- ..-. .- .--- .--- --- --..-- -.- .. ...- ..-.. ...- . .- --.. ..- -. .- .-.. -- .- ... - .-.-.-
.- -. - --- -. .--. .- ...- .-.. --- ...- .. -.-. ... -.-. ... . .... --- ...- ;.- - . .-.. .. .... .- ... -. . -- - .- -. ..- .-.. ... --.. .. ...- . ... . -. .-.-.-
.- .-. .. ... --.. - --- - . .-.. ..-.. ... --.. ;-- .. -. -.. . -. . -- -... . .-. -... . -. ...- .- -. ...- .- .-.. .- -- .. .--- --- .-.-.-
-.-. ... .. ---... -- .. .- -- .. .... . .-.. -.-- ... --.. .. -. . .-.. --- -.- -.-. .-.-.- ..-. .. .-.. -- ;.- .-.. . --. .--- --- -... -... ...- ..-.. -.. . .-.. . -- ---... .- -... . -.-. ... ..-- .-.. . - .-.-.-
.--. --- .-.. .- .-. . -..- .--. .-. . ... --.. ... --.. -.-. .-.-.- ..-. .. .-.. -- ;.- -.- .- .-. .--.- -.-. ... --- -. -.-- .. -.-. ... --- -.. .- .- ... --.. .. ...- . -.. -... . -. .-.. .- -.- .. -.- .-.-.-
.--- --- .... -. .-. --- -. .- .-.. -.. .-. . ..- . .-.. - --- .-.. -.- .. . -. ;.- .... .- .--- -. .- .-.. -- ..-.. --. .. ... .- --.. . -- -... . .-. . -.- ---. .-. ---. -.- .-. . -- ..-.. -. -.-- . .-.-.-

44
Morze/morzeabc.txt Normal file
View File

@ -0,0 +1,44 @@
Betű;Morzekód
A .-
Á .--.-
Ä .-.-
B -...
C -.-.
D -..
E .
É ..-..
F ..-.
G --.
H ....
I ..
J .---
K -.-
L .-..
M --
N -.
O ---
Ö ---.
P .--.
Q --.-
R .-.
S ...
T -
U ..-
Ü ..--
V ...-
W .--
X -..-
Y -.--
Z --..
! --.--
) -.--.-
( -.--.
, --..--
- -....-
+ .-.-.
. .-.-.-
/ -..-.
: ---...
? ..--..
" .-..-.
' .----.