Commit 1e480435 authored by Uwe Wienkop's avatar Uwe Wienkop

12.11.19 Di

parent dc0fa9b4
......@@ -58,18 +58,32 @@ namespace _05CodeDojo
}
#endregion
// Funktion Even, erhält ein Feld und löscht aus dem Feld alle ungeraden Zahlen
static int [] Even(int [] f) { return new int[5]; }
#region Code
static int[] Even(int[] f) { }
static void Even(ref int[] f)
//static void Even(int[] f, out int[] fOut)
static void Even(ref int[] f)
{
// Anzahl der geraden Feldelemente zählen
int anz = 0;
foreach (int item in f)
{
if (item % 2 == 0)
anz++;
}
// Neues Feld entsprechender Größe anlegen
int[] fNeu = new int[anz];
// ...
// Noch ein Durchlauf: Die geraden Elemente umkopieren
int k = 0;
foreach (int item in f)
{
if (item % 2 == 0)
fNeu[k++] = item;
// fNeu[k] = item; k+= 1;
}
// Altes Feld gegen fNeu austauschen
f = fNeu;
}
#endregion
static void Main(string[] args)
......
......@@ -14,6 +14,7 @@ namespace _06CodeDojo
}
Console.WriteLine();
}
Console.WriteLine();
}
static void FeldInitialisieren(int[,] f, int wert)
{
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<RootNamespace>_06Felder2D</RootNamespace>
</PropertyGroup>
</Project>
using System;
namespace _06Felder2D
{
class Program
{
static void Main(string[] args)
{
int[] f1 = new int[100];
int[,] f2 = new int[2,3];
int[,,] f3 = new int[3, 4, 5];
int zaehler = 1;
for (int z = 0; z < f2.GetLength(0); z++)
{
for (int s = 0; s < f2.GetLength(1); s++)
{
f2[z, s] = zaehler++;
}
}
for (int z = 0; z < f2.GetLength(0); z++)
{
for (int s = 0; s < f2.GetLength(1); s++)
{
Console.Write($"[{z},{s}] -- {f2[z,s]} ");
}
Console.WriteLine();
}
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<RootNamespace>_06StringsIntro1</RootNamespace>
</PropertyGroup>
</Project>
using System;
namespace _06StringsIntro1
{
class Program
{
static void Main(string[] args)
{
string s = "Hallo Welt";
char c = 'A'; // Char in EINFACHEN Anführungszeichen
for (int i = 0; i < s.Length; i++)
{
c = s[i];
if (c >= 'a' && c <= 'z')
c = (char)(c - 32);
Console.WriteLine(c);
}
//foreach (char item in s)
//{
// char c = item;
// if (c >= 'a' && c <= 'z')
// item = (char) (c-32);
// Console.WriteLine($"{c} -- {(int) c}");
//}
Console.WriteLine((char) 7);
string[] Tiere = { "Elefant", "Otter", "Schlange" };
s = "Elefant"; // Strings in DOPPELTEN Anführungszeichen
char[] erg = new char[s.Length];
erg[0] = s[0];
for (int i = 1; i < s.Length; i++)
{
erg[i] = '_';
}
}
}
}
......@@ -47,9 +47,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "05CodeDojo", "05CodeDojo\05
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "06CodeDojo", "06CodeDojo\06CodeDojo.csproj", "{AFB15A60-585A-42BF-87C6-BD8D1C587427}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "06FelderSortieren", "06Felder2\06FelderSortieren.csproj", "{C70917DF-1D95-4532-9D85-79E9A57C20CF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "06FelderSortieren", "06Felder2\06FelderSortieren.csproj", "{C70917DF-1D95-4532-9D85-79E9A57C20CF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "06FelderHistogramme", "06FelderHistogramme\06FelderHistogramme.csproj", "{0287FEC1-5015-4789-A33D-5A1B66B30E77}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "06FelderHistogramme", "06FelderHistogramme\06FelderHistogramme.csproj", "{0287FEC1-5015-4789-A33D-5A1B66B30E77}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "06Felder2D", "06Felder2D\06Felder2D.csproj", "{C8207FFC-FFF8-411F-9C13-931E27B11179}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "06StringsIntro1", "06StringsIntro1\06StringsIntro1.csproj", "{F01CE4B4-E2C5-4749-9166-8521B5230222}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -153,6 +157,14 @@ Global
{0287FEC1-5015-4789-A33D-5A1B66B30E77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0287FEC1-5015-4789-A33D-5A1B66B30E77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0287FEC1-5015-4789-A33D-5A1B66B30E77}.Release|Any CPU.Build.0 = Release|Any CPU
{C8207FFC-FFF8-411F-9C13-931E27B11179}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8207FFC-FFF8-411F-9C13-931E27B11179}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8207FFC-FFF8-411F-9C13-931E27B11179}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8207FFC-FFF8-411F-9C13-931E27B11179}.Release|Any CPU.Build.0 = Release|Any CPU
{F01CE4B4-E2C5-4749-9166-8521B5230222}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F01CE4B4-E2C5-4749-9166-8521B5230222}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F01CE4B4-E2C5-4749-9166-8521B5230222}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F01CE4B4-E2C5-4749-9166-8521B5230222}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment