Commit 17c77914 authored by Uwe Wienkop's avatar Uwe Wienkop

Mo, 22.10. Vorlesung

parent 6612cab2
......@@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "02Fallungerscheidungen3", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "02WeitereSchleifentypen", "..\02WeitereSchleifentypen\02WeitereSchleifentypen.csproj", "{7BE593C7-4A69-46F2-9787-8E5E66664FCF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "03ArrayIntro", "..\03ArrayIntro\03ArrayIntro.csproj", "{AE3AAF7B-4F70-4D11-B812-10D5D1976AFC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -69,6 +71,10 @@ Global
{7BE593C7-4A69-46F2-9787-8E5E66664FCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7BE593C7-4A69-46F2-9787-8E5E66664FCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BE593C7-4A69-46F2-9787-8E5E66664FCF}.Release|Any CPU.Build.0 = Release|Any CPU
{AE3AAF7B-4F70-4D11-B812-10D5D1976AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE3AAF7B-4F70-4D11-B812-10D5D1976AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE3AAF7B-4F70-4D11-B812-10D5D1976AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE3AAF7B-4F70-4D11-B812-10D5D1976AFC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -10,6 +10,7 @@ namespace _02WeitereSchleifentypen
{
static void Main(string[] args)
{
// von ... bis zählen
for (int i = 0; i < 5; i++)
{
Console.WriteLine(i);
......@@ -58,7 +59,7 @@ namespace _02WeitereSchleifentypen
}
Console.WriteLine();
if (/* Test */ ) // Möglicher Schleifenabbruch
if (/* Test */true) // Möglicher Schleifenabbruch
break;
for (int i = 0; i < 10; i++)
......
<?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>{AE3AAF7B-4F70-4D11-B812-10D5D1976AFC}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>_03ArrayIntro</RootNamespace>
<AssemblyName>03ArrayIntro</AssemblyName>
<TargetFrameworkVersion>v4.6.1</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>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _03ArrayIntro
{
class Program
{
static void Main(string[] args)
{
int[] feld = { 10, 15, 3, 22, 44, 55, 99, 37, 42, 41, 45, 33, 25 };
//int[] feld = { -1,-2,-3,-4,-5, -6 };
for (int i = 0; i < feld.Length; i++)
{
Console.WriteLine(feld[i]);
}
// Summe der Feldelemente
int summe = 0;
for (int i = 0; i < feld.Length; i++)
summe += feld[i];
Console.WriteLine($"Summe = {summe}");
// Mittelwert der Feldelemente
summe = 0;
for (int i = 0; i < feld.Length; i++)
summe += feld[i];
Console.WriteLine($"Mittelwert = {(double) summe / (double)feld.Length}");
// Maximum der Feldelemente; Variante 1
int max = int.MinValue;
for (int i = 0; i < feld.Length; i++)
{
if (feld[i] > max)
max = feld[i];
}
Console.WriteLine($"Maximum = {max}");
// Maximum der Feldelemente; Variante 2
max = feld[0];
for (int i = 1; i < feld.Length; i++)
{
if (feld[i] > max)
max = feld[i];
}
Console.WriteLine($"Maximum = {max}");
// Minimum der Feldelemente; Variante 2
int min = feld[0];
for (int i = 1; i < feld.Length; i++)
{
if (feld[i] < min)
min = feld[i];
}
Console.WriteLine($"Minimum = {min}");
// Position des maximalen Werts
int maxIndex = 0;
//max = feld[maxIndex];
for (int i = 1; i < feld.Length; i++)
{
if (feld[i] > feld[maxIndex])
{
//max = feld[i];
maxIndex = i;
}
}
Console.WriteLine($"Maximum {feld[maxIndex]} an der Position {maxIndex}");
// Position des minimalen Werts
int minIndex = 0;
for (int i = 1; i < feld.Length; i++)
{
if (feld[i] < feld[minIndex])
{
minIndex = i;
}
}
Console.WriteLine($"Minimum {feld[minIndex]} an der Position {minIndex}");
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("03ArrayIntro")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("03ArrayIntro")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("ae3aaf7b-4f70-4d11-b812-10d5d1976afc")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
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