Commit d4b5a7bd authored by Uwe Wienkop's avatar Uwe Wienkop

Übergabe von Feldern

parent a1249b1e
......@@ -17,7 +17,7 @@ namespace _06Zufallsgütetest
{
int gewuerfelt = R.Next(0, 20);
// anzahlen[gewuerfelt] = anzahlen[gewuerfelt] + 1; -- Richtig
anzahlen[R.Next(0, 20)] = anzahlen[R.Next(0, 20)] +1; //-- Völlig falsch
anzahlen[R.Next(0, 20)] = anzahlen[R.Next(0, 20)] +1; // Völlig falsch: Es werden zwei verschiedene Indices verwendet!
// anzahlen[R.Next(0,20)]+=1; -- richtig
// anzahlen[R.Next(0,20)]++; -- richtig
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{1A633D3F-B34D-4BEA-95B4-EF35144E08B7}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>_07FelderAlsParameter</RootNamespace>
<AssemblyName>07FelderAlsParameter</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</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" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</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 _07FelderAlsParameter
{
class Program
{
static void Ausgeben(int[] feld)
{
//for (int i = 0; i < feld.Length; i++)
//{
// Console.Write($"{feld[i],4}");
//}
//Console.WriteLine();
foreach (int item in feld)
{
Console.Write($"{item,4}");
}
Console.WriteLine();
}
static void Incr(int[] feld, int x)
{
for (int i = 0; i < feld.Length; i++)
{
feld[i]+= 1;
}
x += 1;
}
static void Main(string[] args)
{
int m = 1;
int[] f = { 10, 20, 30, 40, 50, 60, 70 };
Incr(f, m);
Console.WriteLine($"m = {m} ");
Ausgeben(f);
}
}
}
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("07FelderAlsParameter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("07FelderAlsParameter")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[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("1a633d3f-b34d-4bea-95b4-ef35144e08b7")]
// 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")]
......@@ -21,7 +21,7 @@
<ul>
<li>Unterschiede zwischen double und int; double --> Gleitkomma, Rundungsfehler, int --> Ganzzahlige Division, Division mit Rest</li>
<li>
for-Schleife als erste Schleife; Wird i.d.R. für einen Zählen von ... bis verwendet; Bestandteile:
for-Schleife als erste Schleife; Wird i.d.R. für ein Zählen von ... bis verwendet; Bestandteile:
<ol>
<li>Initialisierung der Schleifenvariable; z.B. int i=0 oder double x=0.0</li>
<li>Test des Durchlaufausdrucks; z.B. i<=10 Dieser Test findet vor dem Durchlauf des Schleifenrumpfs statt! Möglicherweise wird somit der Schleifenrumpf nicht durchlaufen!</li>
......
......@@ -56,6 +56,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "06GameOfLife_Console", "06G
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "06Funktionen", "06Funktionen\06Funktionen.csproj", "{9A04ACCA-5FCA-4E1F-A9F4-7E830EC897CD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "07FelderAlsParameter", "07FelderAlsParameter\07FelderAlsParameter.csproj", "{1A633D3F-B34D-4BEA-95B4-EF35144E08B7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -158,6 +160,10 @@ Global
{9A04ACCA-5FCA-4E1F-A9F4-7E830EC897CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A04ACCA-5FCA-4E1F-A9F4-7E830EC897CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A04ACCA-5FCA-4E1F-A9F4-7E830EC897CD}.Release|Any CPU.Build.0 = Release|Any CPU
{1A633D3F-B34D-4BEA-95B4-EF35144E08B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A633D3F-B34D-4BEA-95B4-EF35144E08B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A633D3F-B34D-4BEA-95B4-EF35144E08B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A633D3F-B34D-4BEA-95B4-EF35144E08B7}.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