Compare commits
No commits in common. "master" and "aaee1b02aefd8040328109bf0ae37f559531a250" have entirely different histories.
master
...
aaee1b02ae
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<startup>
|
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
|
||||||
</startup>
|
|
||||||
</configuration>
|
|
|
@ -1,53 +0,0 @@
|
||||||
<?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>{022E0B9A-7125-4EC5-9A08-115025405518}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<RootNamespace>MeccsDoga</RootNamespace>
|
|
||||||
<AssemblyName>MeccsDoga</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>
|
|
|
@ -1,85 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
|
|
||||||
namespace MeccsDoga
|
|
||||||
{
|
|
||||||
class Program
|
|
||||||
{
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
//Beolvasás a merkozesek.txt fájlból 1. mód
|
|
||||||
StreamReader sr = new StreamReader(@"c:\git\merkozesek.txt");
|
|
||||||
//egy sor beolvasása
|
|
||||||
//string elsosor = sr.ReadLine();
|
|
||||||
//Console.WriteLine($"Az állomány első sora: {elsosor}");
|
|
||||||
string[] meccsek = new string[400];
|
|
||||||
int darab = 0;
|
|
||||||
while(!sr.EndOfStream)
|
|
||||||
{
|
|
||||||
meccsek[darab] = sr.ReadLine();
|
|
||||||
darab++;
|
|
||||||
}
|
|
||||||
sr.Close();
|
|
||||||
Console.WriteLine($"A fájlban {darab} meccs adata van.");
|
|
||||||
for (int i = 0; i < darab; i++)
|
|
||||||
{
|
|
||||||
Console.WriteLine(meccsek[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//******************************************
|
|
||||||
//Beolvasás a merkozesek.txt fájlból 2. mód
|
|
||||||
Console.WriteLine("Beolvasás 2. módszer ************************");
|
|
||||||
string[] sorok = File.ReadAllLines(@"c:\git\merkozesek.txt");
|
|
||||||
Console.WriteLine($"A fájlban {sorok.Length} meccs adata van.");
|
|
||||||
foreach (string sor in sorok)
|
|
||||||
{
|
|
||||||
Console.WriteLine(sor);
|
|
||||||
}
|
|
||||||
|
|
||||||
//2. feladat megoldása
|
|
||||||
Console.WriteLine("Adja meg egy forduló számát (1-20):");
|
|
||||||
string fordulo = Console.ReadLine();
|
|
||||||
Console.WriteLine($"2. feladat:\nA {fordulo}. forduló mérkőzései:");
|
|
||||||
foreach (var item in sorok)
|
|
||||||
{
|
|
||||||
if(item.StartsWith(fordulo))
|
|
||||||
{
|
|
||||||
//Console.WriteLine(item);
|
|
||||||
string[] t = item.Split(' ');
|
|
||||||
Console.WriteLine($"{t[3]}-{t[4]}: {t[1]}-{t[2]}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//3. feladat megoldása
|
|
||||||
Console.WriteLine("3. feladat:");
|
|
||||||
int hazai = 0;
|
|
||||||
int vendeg = 0;
|
|
||||||
int remi = 0;
|
|
||||||
foreach (var item in sorok)
|
|
||||||
{
|
|
||||||
string[] t = item.Split(' ');
|
|
||||||
int hgol = int.Parse(t[1]);
|
|
||||||
int vgol = int.Parse(t[2]);
|
|
||||||
if(hgol>vgol)
|
|
||||||
{
|
|
||||||
hazai++;
|
|
||||||
} else if(vgol>hgol)
|
|
||||||
{
|
|
||||||
vendeg++;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
remi++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Console.WriteLine($"Hazai győzelem: {hazai} mérkőzésen");
|
|
||||||
Console.WriteLine($"Vendég győzelem: {vendeg} mérkőzésen");
|
|
||||||
Console.WriteLine($"Döntetlen: {remi} mérkőzésen");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
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("MeccsDoga")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("MeccsDoga")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
|
||||||
[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("022e0b9a-7125-4ec5-9a08-115025405518")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<startup>
|
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
|
||||||
</startup>
|
|
||||||
</configuration>
|
|
|
@ -1,36 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MeccsDogaObject
|
|
||||||
{
|
|
||||||
class Meccs
|
|
||||||
{
|
|
||||||
public int fordulo;
|
|
||||||
public int hazaigol;
|
|
||||||
public int vendeggol;
|
|
||||||
public string hazaicsapat;
|
|
||||||
public string vendegcsapat;
|
|
||||||
//private bool este;
|
|
||||||
|
|
||||||
public Meccs()
|
|
||||||
{
|
|
||||||
Console.WriteLine("Az üres konstruktor törzse.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public Meccs(string adatsor)
|
|
||||||
{
|
|
||||||
Console.WriteLine("A string paraméteres konstruktor törzse.");
|
|
||||||
string[] t = adatsor.Split(' ');
|
|
||||||
fordulo = int.Parse(t[0]);
|
|
||||||
hazaigol = int.Parse(t[1]);
|
|
||||||
vendeggol = int.Parse(t[2]);
|
|
||||||
hazaicsapat = t[3];
|
|
||||||
vendegcsapat = t[4];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
<?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>{B0483911-FD39-46E1-BDA7-4773F1409664}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<RootNamespace>MeccsDogaObject</RootNamespace>
|
|
||||||
<AssemblyName>MeccsDogaObject</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="Meccs.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="App.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
</Project>
|
|
|
@ -1,53 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MeccsDogaObject
|
|
||||||
{
|
|
||||||
|
|
||||||
class Match
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
class Program
|
|
||||||
{
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
//A Meccs objektumok használata
|
|
||||||
Meccs m1 = new Meccs();
|
|
||||||
m1.fordulo = 15;
|
|
||||||
m1.hazaigol = 2;
|
|
||||||
m1.vendeggol = 1;
|
|
||||||
m1.hazaicsapat = "gszisc";
|
|
||||||
m1.vendegcsapat = "koosfc";
|
|
||||||
Meccs m2 = new Meccs();
|
|
||||||
m2.fordulo = 3;
|
|
||||||
m2.hazaigol = 0;
|
|
||||||
m2.vendeggol = 0;
|
|
||||||
m2.hazaicsapat = "11b_válogatott";
|
|
||||||
m2.vendegcsapat = "11c_válogatott";
|
|
||||||
Console.WriteLine($"m1 csapatok: {m1.hazaicsapat}-{m1.vendegcsapat}");
|
|
||||||
Console.WriteLine($"m2 csapatok: {m2.hazaicsapat}-{m2.vendegcsapat}");
|
|
||||||
Meccs m3 = new Meccs("8 2 4 BCSElőre PuskásA");
|
|
||||||
Console.WriteLine($"m3 csapatok: {m3.hazaicsapat}-{m3.vendegcsapat}: {m3.hazaigol}-{m3.vendeggol}");
|
|
||||||
|
|
||||||
//1. feladat beolvasás és tárolás
|
|
||||||
Meccs[] merkozesek = new Meccs[400];
|
|
||||||
string[] sorok = File.ReadAllLines(@"c:\git\merkozesek.txt");
|
|
||||||
Console.WriteLine($"A fájlban {sorok.Length} meccs adata van.");
|
|
||||||
int mix = 0;
|
|
||||||
foreach (string sor in sorok)
|
|
||||||
{
|
|
||||||
merkozesek[mix] = new Meccs(sor);
|
|
||||||
mix++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
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("MeccsDogaObject")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("MeccsDogaObject")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
|
||||||
[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("b0483911-fd39-46e1-bda7-4773f1409664")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
12
Tombok1.sln
12
Tombok1.sln
|
@ -5,10 +5,6 @@ VisualStudioVersion = 16.0.33027.164
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tombok1", "Tombok1\Tombok1.csproj", "{16742F0A-8F9C-4E0E-BDD3-ED4E99052AAD}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tombok1", "Tombok1\Tombok1.csproj", "{16742F0A-8F9C-4E0E-BDD3-ED4E99052AAD}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeccsDoga", "MeccsDoga\MeccsDoga.csproj", "{022E0B9A-7125-4EC5-9A08-115025405518}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeccsDogaObject", "MeccsDogaObject\MeccsDogaObject.csproj", "{B0483911-FD39-46E1-BDA7-4773F1409664}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -19,14 +15,6 @@ Global
|
||||||
{16742F0A-8F9C-4E0E-BDD3-ED4E99052AAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{16742F0A-8F9C-4E0E-BDD3-ED4E99052AAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{16742F0A-8F9C-4E0E-BDD3-ED4E99052AAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{16742F0A-8F9C-4E0E-BDD3-ED4E99052AAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{16742F0A-8F9C-4E0E-BDD3-ED4E99052AAD}.Release|Any CPU.Build.0 = Release|Any CPU
|
{16742F0A-8F9C-4E0E-BDD3-ED4E99052AAD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{022E0B9A-7125-4EC5-9A08-115025405518}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{022E0B9A-7125-4EC5-9A08-115025405518}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{022E0B9A-7125-4EC5-9A08-115025405518}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{022E0B9A-7125-4EC5-9A08-115025405518}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{B0483911-FD39-46E1-BDA7-4773F1409664}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{B0483911-FD39-46E1-BDA7-4773F1409664}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{B0483911-FD39-46E1-BDA7-4773F1409664}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{B0483911-FD39-46E1-BDA7-4773F1409664}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -11,78 +11,6 @@ namespace Tombok1
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Tömbök gyakorlása.");
|
Console.WriteLine("Tömbök gyakorlása.");
|
||||||
//Tömbök megadása
|
|
||||||
int[] szamok1 = {0,4,7,33,-12 };
|
|
||||||
int[] szamok2 = new int[10];
|
|
||||||
//deklarálás és definiálás két külön lépésben
|
|
||||||
double[] valosok;
|
|
||||||
Console.WriteLine("Ezután hozom létre a valosok tömböt.");
|
|
||||||
valosok = new double[100];
|
|
||||||
|
|
||||||
//tömb tartalmának megjelenítése
|
|
||||||
Console.WriteLine(szamok1); //csak a típust írja ki
|
|
||||||
Console.WriteLine(valosok); //csak a típust írja ki
|
|
||||||
|
|
||||||
foreach (double vszam in valosok)
|
|
||||||
{
|
|
||||||
Console.WriteLine(vszam);
|
|
||||||
}
|
|
||||||
//mejelenítés hagyományos for ciklussal
|
|
||||||
for (int i = 0; i < valosok.Length; i++)
|
|
||||||
{
|
|
||||||
Console.WriteLine(valosok[i]); // az i-dik tömbelem elérése
|
|
||||||
}
|
|
||||||
|
|
||||||
//tömb elemeinek módosítása
|
|
||||||
Random rd = new Random();
|
|
||||||
for (int i = 0; i < valosok.Length; i++)
|
|
||||||
{
|
|
||||||
valosok[i] = rd.NextDouble();
|
|
||||||
}
|
|
||||||
foreach (double vszam in valosok)
|
|
||||||
{
|
|
||||||
Console.WriteLine(vszam);
|
|
||||||
}
|
|
||||||
//utolsó előtti valós szám csak egyedül újra:
|
|
||||||
Console.WriteLine($"Az utolsó előtti: {valosok[valosok.Length-2]}");
|
|
||||||
|
|
||||||
//szamok2 tömb feltöltése 30 és 900 közötti véletlenszámokkal, majd annak kiírása
|
|
||||||
for (int i = 0; i < szamok2.Length; i++)
|
|
||||||
{
|
|
||||||
szamok2[i] = rd.Next(30,901);
|
|
||||||
}
|
|
||||||
foreach (int vszam in szamok2)
|
|
||||||
{
|
|
||||||
Console.WriteLine(vszam);
|
|
||||||
}
|
|
||||||
|
|
||||||
//karakter tömb
|
|
||||||
char[] betuk = {'a','*','~','4','\t','\n','ű'};
|
|
||||||
|
|
||||||
|
|
||||||
//string mint karaktertömb kezelése
|
|
||||||
string szoveg = "almafa";
|
|
||||||
Console.WriteLine(szoveg[3]);
|
|
||||||
char hhh = szoveg[2];
|
|
||||||
|
|
||||||
//string tömb létrehozása
|
|
||||||
string[] napok = {"hétfő","kedd","szerda","csütörtök","péntek","szombat","vasárnap"};
|
|
||||||
//20 elemű üres tömb létrehozása
|
|
||||||
string[] nevek = new string[20];
|
|
||||||
nevek[0] = "Adrienn";
|
|
||||||
Console.WriteLine($"A nevek tömb első eleme: {nevek[1]}");
|
|
||||||
|
|
||||||
//logikai értékek tömbje
|
|
||||||
bool[] fejvagyiras = { true, true, false, false, true };
|
|
||||||
int flagdb = 345;
|
|
||||||
bool[] flagek = new bool[flagdb*4];
|
|
||||||
|
|
||||||
//objektumok tömbje
|
|
||||||
Random[] generatorok = new Random[6];
|
|
||||||
generatorok[3] = new Random(45);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user