TODO finish HF
This commit is contained in:
parent
e855b0fa00
commit
2134005486
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\ProgaOra\\20250219\\asztali_minta_valasztas\\Valasztas\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{3974D06D-94FE-4C3E-91C2-DB8E3DD9609E}|Valasztas\\Valasztas.csproj|c:\\users\\szabomarton\\desktop\\progaora\\20250219\\asztali_minta_valasztas\\valasztas\\valasztas\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{3974D06D-94FE-4C3E-91C2-DB8E3DD9609E}|Valasztas\\Valasztas.csproj|solutionrelative:valasztas\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 0,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Program.cs",
|
||||
"DocumentMoniker": "C:\\Users\\szabomarton\\Desktop\\ProgaOra\\20250219\\asztali_minta_valasztas\\Valasztas\\Valasztas\\Program.cs",
|
||||
"RelativeDocumentMoniker": "Valasztas\\Program.cs",
|
||||
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\ProgaOra\\20250219\\asztali_minta_valasztas\\Valasztas\\Valasztas\\Program.cs",
|
||||
"RelativeToolTip": "Valasztas\\Program.cs",
|
||||
"ViewState": "AgIAAFcAAAAAAAAAAAAcwHIAAAAqAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-02-19T11:10:56.261Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\ProgaOra\\20250219\\asztali_minta_valasztas\\Valasztas\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{3974D06D-94FE-4C3E-91C2-DB8E3DD9609E}|Valasztas\\Valasztas.csproj|c:\\users\\szabomarton\\desktop\\progaora\\20250219\\asztali_minta_valasztas\\valasztas\\valasztas\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{3974D06D-94FE-4C3E-91C2-DB8E3DD9609E}|Valasztas\\Valasztas.csproj|solutionrelative:valasztas\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 0,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Program.cs",
|
||||
"DocumentMoniker": "C:\\Users\\szabomarton\\Desktop\\ProgaOra\\20250219\\asztali_minta_valasztas\\Valasztas\\Valasztas\\Program.cs",
|
||||
"RelativeDocumentMoniker": "Valasztas\\Program.cs",
|
||||
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\ProgaOra\\20250219\\asztali_minta_valasztas\\Valasztas\\Valasztas\\Program.cs",
|
||||
"RelativeToolTip": "Valasztas\\Program.cs",
|
||||
"ViewState": "AgIAAFcAAAAAAAAAAAAcwHIAAAAqAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-02-19T11:10:56.261Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
22
20250219/asztali_minta_valasztas/Valasztas/Valasztas.sln
Normal file
22
20250219/asztali_minta_valasztas/Valasztas/Valasztas.sln
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35707.178 d17.12
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Valasztas", "Valasztas\Valasztas.csproj", "{3974D06D-94FE-4C3E-91C2-DB8E3DD9609E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3974D06D-94FE-4C3E-91C2-DB8E3DD9609E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3974D06D-94FE-4C3E-91C2-DB8E3DD9609E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3974D06D-94FE-4C3E-91C2-DB8E3DD9609E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3974D06D-94FE-4C3E-91C2-DB8E3DD9609E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
118
20250219/asztali_minta_valasztas/Valasztas/Valasztas/Program.cs
Normal file
118
20250219/asztali_minta_valasztas/Valasztas/Valasztas/Program.cs
Normal file
|
@ -0,0 +1,118 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Valasztas
|
||||
{
|
||||
public class Kepviselo
|
||||
{
|
||||
public int Kerulet;
|
||||
public int Szavazat;
|
||||
public string VezetekNev;
|
||||
public string KeresztNev;
|
||||
public string Part;
|
||||
|
||||
public Kepviselo(int kerulet, int szavazat,
|
||||
string vezetekNev, string keresztNev,
|
||||
string part) {
|
||||
this.Kerulet = kerulet;
|
||||
this.Szavazat = szavazat;
|
||||
this.VezetekNev = vezetekNev;
|
||||
this.KeresztNev = keresztNev;
|
||||
this.Part = part;
|
||||
}
|
||||
|
||||
public static List<Kepviselo> LoadFromTxt(string path)
|
||||
{
|
||||
List<Kepviselo> kepviselok = new List<Kepviselo>();
|
||||
|
||||
FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
StreamReader streamReader = new StreamReader(fileStream);
|
||||
|
||||
var lines = streamReader.ReadToEnd().Split('\n');
|
||||
|
||||
foreach (var item in lines)
|
||||
{
|
||||
string[] data = item.Split(' ');
|
||||
Kepviselo kepviselo = new Kepviselo(Convert.ToInt32(data[0]), Convert.ToInt32(data[1]), data[2], data[3], data[4]);
|
||||
kepviselok.Add(kepviselo);
|
||||
}
|
||||
|
||||
streamReader.Close();
|
||||
fileStream.Close();
|
||||
|
||||
return kepviselok;
|
||||
}
|
||||
|
||||
public static void SzavazatKiir(List<Kepviselo> kepviselok, string[] nev)
|
||||
{
|
||||
foreach (var item in kepviselok)
|
||||
{
|
||||
if (item.VezetekNev == nev[0] && item.KeresztNev == nev[1])
|
||||
{
|
||||
Console.WriteLine($"{item.VezetekNev} {item.KeresztNev} nevű képviselőjelölt {item.Szavazat} darab szavazatot kapott.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine("Ilyen nevű képviselőjelölt nem szerepel a nyilvántartásban!");
|
||||
}
|
||||
|
||||
public static void Legtobb(List<Kepviselo> kepviselok)
|
||||
{
|
||||
List<Kepviselo> legjobbkepviselok = new List<Kepviselo>();
|
||||
Kepviselo kepviselo = kepviselok[0];
|
||||
|
||||
foreach (var item in kepviselok)
|
||||
{
|
||||
if (item.Szavazat > kepviselo.Szavazat)
|
||||
{
|
||||
kepviselo = item;
|
||||
}
|
||||
}
|
||||
|
||||
legjobbkepviselok.Add(kepviselo);
|
||||
|
||||
foreach (var item in kepviselok)
|
||||
{
|
||||
if (item.Szavazat == kepviselo.Szavazat && item.KeresztNev != kepviselo.KeresztNev && item.VezetekNev != kepviselo.VezetekNev)
|
||||
{
|
||||
legjobbkepviselok.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
string fuggetlen = "független";
|
||||
|
||||
foreach (var item in legjobbkepviselok)
|
||||
{
|
||||
Console.WriteLine($"" +
|
||||
$"A legtöbb szavazatot kapta: " +
|
||||
$"\t{item.VezetekNev} {item.KeresztNev} {(item.Part == "-" ? fuggetlen : item.Part)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string path = "szavazatok.txt";
|
||||
|
||||
List<Kepviselo> kepviselok = new List<Kepviselo>();
|
||||
kepviselok = Kepviselo.LoadFromTxt(path);
|
||||
|
||||
//6.feladat
|
||||
Console.Write("Add meg a keresett képviselő nevét:\t");
|
||||
string[] nev = Console.ReadLine().Split(' ');
|
||||
|
||||
Kepviselo.SzavazatKiir(kepviselok, nev);
|
||||
Kepviselo.Legtobb(kepviselok);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Valasztas")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Valasztas")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("3974d06d-94fe-4c3e-91c2-db8e3dd9609e")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{3974D06D-94FE-4C3E-91C2-DB8E3DD9609E}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Valasztas</RootNamespace>
|
||||
<AssemblyName>Valasztas</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Binary file not shown.
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
Binary file not shown.
|
@ -0,0 +1,40 @@
|
|||
5 19 Ablak Antal -
|
||||
1 120 Alma Dalma GYEP
|
||||
7 162 Bab Zsuzsanna ZEP
|
||||
2 59 Barack Barna GYEP
|
||||
6 73 Birs Helga GYEP
|
||||
1 154 Bors Botond HEP
|
||||
5 188 Brokkoli Gyula ZEP
|
||||
6 29 Ceruza Zsombor -
|
||||
4 143 Fasirt Ferenc HEP
|
||||
8 157 Gomba Gitta TISZ
|
||||
3 13 Halmi Helga -
|
||||
2 66 Hold Ferenc -
|
||||
7 34 Hurka Herold HEP
|
||||
5 288 Joghurt Jakab TISZ
|
||||
4 77 Kajszi Kolos GYEP
|
||||
2 187 Kapor Karola ZEP
|
||||
6 13 Karfiol Ede ZEP
|
||||
6 187 Kefir Ilona TISZ
|
||||
7 130 Kupa Huba -
|
||||
8 98 Languszta Auguszta -
|
||||
1 34 Lila Lilla -
|
||||
1 56 Medve Rudolf -
|
||||
5 67 Meggy Csilla GYEP
|
||||
3 45 Moly Piroska -
|
||||
4 221 Monitor Tibor -
|
||||
8 288 Narancs Edmond GYEP
|
||||
2 220 Oldalas Olga HEP
|
||||
3 185 Pacal Kata HEP
|
||||
1 199 Petrezselyem Petra ZEP
|
||||
8 77 Pokol Vidor -
|
||||
8 67 Ragu Ida HEP
|
||||
3 156 Retek Etelka ZEP
|
||||
7 129 Sajt Hajnalka TISZ
|
||||
4 38 Simon Simon -
|
||||
3 87 Szilva Szilvia GYEP
|
||||
3 187 Tejes Attila TISZ
|
||||
2 65 Tejfel Edit TISZ
|
||||
4 39 Uborka Ubul ZEP
|
||||
6 288 Vadas Marcell HEP
|
||||
5 68 Vagdalt Edit HEP
|
|
@ -0,0 +1,4 @@
|
|||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
137ddb1975586287657f37337b64d051167bb6a147915d9fb5b8eb94b1093509
|
|
@ -0,0 +1,7 @@
|
|||
C:\Users\szabomarton\Desktop\ProgaOra\20250219\asztali_minta_valasztas\Valasztas\Valasztas\bin\Debug\Valasztas.exe.config
|
||||
C:\Users\szabomarton\Desktop\ProgaOra\20250219\asztali_minta_valasztas\Valasztas\Valasztas\bin\Debug\Valasztas.exe
|
||||
C:\Users\szabomarton\Desktop\ProgaOra\20250219\asztali_minta_valasztas\Valasztas\Valasztas\bin\Debug\Valasztas.pdb
|
||||
C:\Users\szabomarton\Desktop\ProgaOra\20250219\asztali_minta_valasztas\Valasztas\Valasztas\obj\Debug\Valasztas.csproj.AssemblyReference.cache
|
||||
C:\Users\szabomarton\Desktop\ProgaOra\20250219\asztali_minta_valasztas\Valasztas\Valasztas\obj\Debug\Valasztas.csproj.CoreCompileInputs.cache
|
||||
C:\Users\szabomarton\Desktop\ProgaOra\20250219\asztali_minta_valasztas\Valasztas\Valasztas\obj\Debug\Valasztas.exe
|
||||
C:\Users\szabomarton\Desktop\ProgaOra\20250219\asztali_minta_valasztas\Valasztas\Valasztas\obj\Debug\Valasztas.pdb
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
40
20250219/asztali_minta_valasztas/szavazatok.txt
Normal file
40
20250219/asztali_minta_valasztas/szavazatok.txt
Normal file
|
@ -0,0 +1,40 @@
|
|||
5 19 Ablak Antal -
|
||||
1 120 Alma Dalma GYEP
|
||||
7 162 Bab Zsuzsanna ZEP
|
||||
2 59 Barack Barna GYEP
|
||||
6 73 Birs Helga GYEP
|
||||
1 154 Bors Botond HEP
|
||||
5 188 Brokkoli Gyula ZEP
|
||||
6 29 Ceruza Zsombor -
|
||||
4 143 Fasirt Ferenc HEP
|
||||
8 157 Gomba Gitta TISZ
|
||||
3 13 Halmi Helga -
|
||||
2 66 Hold Ferenc -
|
||||
7 34 Hurka Herold HEP
|
||||
5 288 Joghurt Jakab TISZ
|
||||
4 77 Kajszi Kolos GYEP
|
||||
2 187 Kapor Karola ZEP
|
||||
6 13 Karfiol Ede ZEP
|
||||
6 187 Kefir Ilona TISZ
|
||||
7 130 Kupa Huba -
|
||||
8 98 Languszta Auguszta -
|
||||
1 34 Lila Lilla -
|
||||
1 56 Medve Rudolf -
|
||||
5 67 Meggy Csilla GYEP
|
||||
3 45 Moly Piroska -
|
||||
4 221 Monitor Tibor -
|
||||
8 288 Narancs Edmond GYEP
|
||||
2 220 Oldalas Olga HEP
|
||||
3 185 Pacal Kata HEP
|
||||
1 199 Petrezselyem Petra ZEP
|
||||
8 77 Pokol Vidor -
|
||||
8 67 Ragu Ida HEP
|
||||
3 156 Retek Etelka ZEP
|
||||
7 129 Sajt Hajnalka TISZ
|
||||
4 38 Simon Simon -
|
||||
3 87 Szilva Szilvia GYEP
|
||||
3 187 Tejes Attila TISZ
|
||||
2 65 Tejfel Edit TISZ
|
||||
4 39 Uborka Ubul ZEP
|
||||
6 288 Vadas Marcell HEP
|
||||
5 68 Vagdalt Edit HEP
|
Loading…
Reference in New Issue
Block a user