Added everything from Neumann
This commit is contained in:
BIN
20230918/ConsoleApp1/.vs/ConsoleApp1/v16/.suo
Normal file
BIN
20230918/ConsoleApp1/.vs/ConsoleApp1/v16/.suo
Normal file
Binary file not shown.
6
20230918/ConsoleApp1/App.config
Normal file
6
20230918/ConsoleApp1/App.config
Normal file
@@ -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>
|
||||
53
20230918/ConsoleApp1/ConsoleApp1.csproj
Normal file
53
20230918/ConsoleApp1/ConsoleApp1.csproj
Normal file
@@ -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>{EC6B1EA9-EFEA-4037-83F4-C4FCD03C3ED0}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>ConsoleApp1</RootNamespace>
|
||||
<AssemblyName>ConsoleApp1</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>
|
||||
25
20230918/ConsoleApp1/ConsoleApp1.sln
Normal file
25
20230918/ConsoleApp1/ConsoleApp1.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.33529.622
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1.csproj", "{EC6B1EA9-EFEA-4037-83F4-C4FCD03C3ED0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EC6B1EA9-EFEA-4037-83F4-C4FCD03C3ED0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EC6B1EA9-EFEA-4037-83F4-C4FCD03C3ED0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EC6B1EA9-EFEA-4037-83F4-C4FCD03C3ED0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EC6B1EA9-EFEA-4037-83F4-C4FCD03C3ED0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {0223D6F6-1BC6-435B-A3DA-7FCDED0C50A3}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
200
20230918/ConsoleApp1/Program.cs
Normal file
200
20230918/ConsoleApp1/Program.cs
Normal file
@@ -0,0 +1,200 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp1
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static class GlobalData
|
||||
{
|
||||
public static int[] szamok = new int[100];
|
||||
public static int[] kisebb250 = { };
|
||||
}
|
||||
|
||||
static void Feladat1()
|
||||
{
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < GlobalData.szamok.Length; i++)
|
||||
{
|
||||
GlobalData.szamok[i] = random.Next(100, 500);
|
||||
}
|
||||
}
|
||||
|
||||
static void Feladat2()
|
||||
{
|
||||
int sum = 0;
|
||||
foreach (int n in GlobalData.szamok)
|
||||
{
|
||||
sum += n;
|
||||
}
|
||||
Console.WriteLine(sum);
|
||||
}
|
||||
|
||||
static void Feladat3()
|
||||
{
|
||||
bool van100 = false;
|
||||
foreach (int n in GlobalData.szamok)
|
||||
{
|
||||
if (n == 100)
|
||||
{
|
||||
van100 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (van100)
|
||||
{
|
||||
Console.WriteLine("Van 100 a listában.");
|
||||
} else
|
||||
{
|
||||
Console.WriteLine("Nincs 100 a listában.");
|
||||
}
|
||||
}
|
||||
|
||||
static void Feladat4()
|
||||
{
|
||||
int max = GlobalData.szamok[0];
|
||||
foreach (int n in GlobalData.szamok)
|
||||
{
|
||||
if (n > max)
|
||||
{
|
||||
max = n;
|
||||
}
|
||||
}
|
||||
Console.WriteLine($"A legnagyobb szám: {max}");
|
||||
}
|
||||
|
||||
static void Feladat5()
|
||||
{
|
||||
int min = GlobalData.szamok[0];
|
||||
foreach (int n in GlobalData.szamok)
|
||||
{
|
||||
if (n < min)
|
||||
{
|
||||
min = n;
|
||||
}
|
||||
}
|
||||
Console.WriteLine($"A legkisebb szám: {min}");
|
||||
}
|
||||
|
||||
static void Feladat6()
|
||||
{
|
||||
foreach (int n in GlobalData.szamok)
|
||||
{
|
||||
if (n < 250)
|
||||
{
|
||||
GlobalData.kisebb250 = GlobalData.kisebb250.Append(n).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Feladat7(int keresendo)
|
||||
{
|
||||
int index = 0;
|
||||
for (int i = 0; i < GlobalData.kisebb250.Length; i++)
|
||||
{
|
||||
if(GlobalData.kisebb250[i] == keresendo)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
index = -1;
|
||||
}
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
Console.WriteLine("Nincs ilyen elem.");
|
||||
} else
|
||||
{
|
||||
Console.WriteLine($"Az elem indexe: {index}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void Feladat8()
|
||||
{
|
||||
for (int j = 0; j < GlobalData.kisebb250.Length; j++)
|
||||
{
|
||||
for (int g = 0; g < GlobalData.kisebb250.Length; g++)
|
||||
{
|
||||
if (GlobalData.kisebb250[j] < GlobalData.kisebb250[g])
|
||||
{
|
||||
int seged = GlobalData.kisebb250[j];
|
||||
GlobalData.kisebb250[j] = GlobalData.kisebb250[g];
|
||||
GlobalData.kisebb250[g] = seged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (int n in GlobalData.kisebb250)
|
||||
{
|
||||
Console.WriteLine(n);
|
||||
}
|
||||
}
|
||||
|
||||
static void Feladat9()
|
||||
{
|
||||
int lngt = GlobalData.szamok.Length;
|
||||
for (int j = 0; j < lngt; j++)
|
||||
{
|
||||
for (int g = 0; g < (lngt - 1); g++)
|
||||
{
|
||||
if (GlobalData.szamok[g] > GlobalData.szamok[g + 1])
|
||||
{
|
||||
int seged = GlobalData.szamok[g + 1];
|
||||
GlobalData.szamok[g + 1] = GlobalData.szamok[g];
|
||||
GlobalData.szamok[g] = seged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (int n in GlobalData.szamok)
|
||||
{
|
||||
Console.WriteLine(n);
|
||||
}
|
||||
}
|
||||
|
||||
static void Feladat10(int keresendo)
|
||||
{
|
||||
Console.WriteLine(Array.BinarySearch(GlobalData.szamok, keresendo));
|
||||
}
|
||||
|
||||
static void Feladat11(int keresendo)
|
||||
{
|
||||
Console.WriteLine(Array.BinarySearch(GlobalData.szamok, keresendo));
|
||||
|
||||
int i = GlobalData.szamok.Length / 2;
|
||||
int megold = -1;
|
||||
int ciklus = 2;
|
||||
while (megold == -1)
|
||||
{
|
||||
if (GlobalData.szamok[i] > keresendo)
|
||||
{
|
||||
int num = Convert.ToInt32(Math.Pow(2, ciklus));
|
||||
i += GlobalData.szamok.Length / (num);
|
||||
} else
|
||||
{
|
||||
int num = Convert.ToInt32(Math.Pow(2, ciklus));
|
||||
i -= GlobalData.szamok.Length / (num);
|
||||
}
|
||||
}
|
||||
}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Feladat1();
|
||||
Feladat2();
|
||||
Feladat3();
|
||||
Feladat4();
|
||||
Feladat5();
|
||||
Feladat6();
|
||||
Feladat7(150);
|
||||
Feladat8();
|
||||
Feladat9();
|
||||
Feladat10(150);
|
||||
Feladat11(150);
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
20230918/ConsoleApp1/Properties/AssemblyInfo.cs
Normal file
36
20230918/ConsoleApp1/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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("ConsoleApp1")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ConsoleApp1")]
|
||||
[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("ec6b1ea9-efea-4037-83f4-c4fcd03c3ed0")]
|
||||
|
||||
// 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")]
|
||||
BIN
20230918/ConsoleApp1/bin/Debug/ConsoleApp1.exe
Normal file
BIN
20230918/ConsoleApp1/bin/Debug/ConsoleApp1.exe
Normal file
Binary file not shown.
6
20230918/ConsoleApp1/bin/Debug/ConsoleApp1.exe.config
Normal file
6
20230918/ConsoleApp1/bin/Debug/ConsoleApp1.exe.config
Normal file
@@ -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>
|
||||
BIN
20230918/ConsoleApp1/bin/Debug/ConsoleApp1.pdb
Normal file
BIN
20230918/ConsoleApp1/bin/Debug/ConsoleApp1.pdb
Normal file
Binary file not shown.
@@ -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.
@@ -0,0 +1 @@
|
||||
7f4b213b428f4c013f19137338418ee1f5525793
|
||||
@@ -0,0 +1,7 @@
|
||||
C:\Users\szabomarton\Desktop\C#\20230918\ConsoleApp1\bin\Debug\ConsoleApp1.exe.config
|
||||
C:\Users\szabomarton\Desktop\C#\20230918\ConsoleApp1\bin\Debug\ConsoleApp1.exe
|
||||
C:\Users\szabomarton\Desktop\C#\20230918\ConsoleApp1\bin\Debug\ConsoleApp1.pdb
|
||||
C:\Users\szabomarton\Desktop\C#\20230918\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.AssemblyReference.cache
|
||||
C:\Users\szabomarton\Desktop\C#\20230918\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.CoreCompileInputs.cache
|
||||
C:\Users\szabomarton\Desktop\C#\20230918\ConsoleApp1\obj\Debug\ConsoleApp1.exe
|
||||
C:\Users\szabomarton\Desktop\C#\20230918\ConsoleApp1\obj\Debug\ConsoleApp1.pdb
|
||||
BIN
20230918/ConsoleApp1/obj/Debug/ConsoleApp1.exe
Normal file
BIN
20230918/ConsoleApp1/obj/Debug/ConsoleApp1.exe
Normal file
Binary file not shown.
BIN
20230918/ConsoleApp1/obj/Debug/ConsoleApp1.pdb
Normal file
BIN
20230918/ConsoleApp1/obj/Debug/ConsoleApp1.pdb
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user