Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Uwe Wienkop
Prog1_WS2018_19_Wienkop
Commits
6612cab2
Commit
6612cab2
authored
Oct 17, 2018
by
Uwe Wienkop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Schleifentypen
parent
454899d1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
185 additions
and
7 deletions
+185
-7
01Pythagoras/Prog1_WS2018.sln
01Pythagoras/Prog1_WS2018.sln
+6
-0
02Primzahltest1/02Primzahltest1/Program.cs
02Primzahltest1/02Primzahltest1/Program.cs
+12
-7
02WeitereSchleifentypen/02WeitereSchleifentypen.csproj
02WeitereSchleifentypen/02WeitereSchleifentypen.csproj
+53
-0
02WeitereSchleifentypen/App.config
02WeitereSchleifentypen/App.config
+6
-0
02WeitereSchleifentypen/Program.cs
02WeitereSchleifentypen/Program.cs
+72
-0
02WeitereSchleifentypen/Properties/AssemblyInfo.cs
02WeitereSchleifentypen/Properties/AssemblyInfo.cs
+36
-0
No files found.
01Pythagoras/Prog1_WS2018.sln
View file @
6612cab2
...
...
@@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "02Ausgabeaufbereitungen", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "02Fallungerscheidungen3", "..\02Fallungerscheidungen3\02Fallungerscheidungen3.csproj", "{18B1C79E-315A-4B0F-BAB8-D364E51ABD5B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "02WeitereSchleifentypen", "..\02WeitereSchleifentypen\02WeitereSchleifentypen.csproj", "{7BE593C7-4A69-46F2-9787-8E5E66664FCF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
...
...
@@ -63,6 +65,10 @@ Global
{18B1C79E-315A-4B0F-BAB8-D364E51ABD5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18B1C79E-315A-4B0F-BAB8-D364E51ABD5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18B1C79E-315A-4B0F-BAB8-D364E51ABD5B}.Release|Any CPU.Build.0 = Release|Any CPU
{7BE593C7-4A69-46F2-9787-8E5E66664FCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
02Primzahltest1/02Primzahltest1/Program.cs
View file @
6612cab2
...
...
@@ -10,23 +10,28 @@ namespace _02Primzahltest1
{
static
void
Main
(
string
[]
args
)
{
for
(
int
zahl
=
3
;
zahl
<=
1000
;
zahl
+
+
)
for
(
int
zahl
=
3
;
zahl
<=
1000
;
zahl
+
=
2
)
{
int
anzTeiler
=
0
;
for
(
int
teiler
=
2
;
teiler
<
zahl
;
teiler
++)
bool
istPrimzahl
=
true
;
int
rest
=
0
;
for
(
int
teiler
=
3
;
teiler
<
zahl
;
teiler
+=
2
)
{
int
rest
=
zahl
%
teiler
;
rest
=
zahl
%
teiler
;
if
(
rest
==
0
)
{
//Console.WriteLine($"{zahl} ist durch {teiler} teilbar");
anzTeiler
++;
istPrimzahl
=
false
;
//break;
}
//else
// istPrimzahl = true;
//else
// Console.WriteLine($"{zahl} ist NICHT durch {teiler} teilbar");
}
//for (int i = 0; i < 100000000; i++) ;
if
(
anzTeiler
==
0
)
if
(
rest
!=
0
)
if
(
istPrimzahl
==
true
)
Console
.
WriteLine
(
$"
{
zahl
}
ist eine Primzahl"
);
//else
// Console.WriteLine($"Nein! {zahl} ist keine Primzahl. Sie hat {anzTeiler} Teiler.");
...
...
02WeitereSchleifentypen/02WeitereSchleifentypen.csproj
0 → 100644
View file @
6612cab2
<?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>
{7BE593C7-4A69-46F2-9787-8E5E66664FCF}
</ProjectGuid>
<OutputType>
Exe
</OutputType>
<RootNamespace>
_02WeitereSchleifentypen
</RootNamespace>
<AssemblyName>
02WeitereSchleifentypen
</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
02WeitereSchleifentypen/App.config
0 → 100644
View file @
6612cab2
<?
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
02WeitereSchleifentypen/Program.cs
0 → 100644
View file @
6612cab2
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
_02WeitereSchleifentypen
{
class
Program
{
static
void
Main
(
string
[]
args
)
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
Console
.
WriteLine
(
i
);
}
Console
.
WriteLine
(
"---- While ---"
);
// While-Schleife ~ Solange etwas gilt, mache ...
// Also: Erst wird getestet, dann ggf. getan/wiederholt
int
j
=
0
;
// Initialisierung
while
(
j
<
5
)
// Test, ob wiederholt werden soll
{
Console
.
WriteLine
(
j
);
j
++;
// Weiterschalten
}
Console
.
WriteLine
(
"---- Do - While ---"
);
// Do-While-Schleife ~ Mache - teste - mache - teste ...
// also: erst tun, dann testen
int
k
=
0
;
do
{
Console
.
WriteLine
(
k
);
k
++;
}
while
(
k
<
5
);
// Beispiel für Verwendung der do-while-Schleife
string
nochmal
;
do
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
Console
.
Write
(
$"
{
i
}
"
);
}
Console
.
WriteLine
();
Console
.
Write
(
"Noch einmal? "
);
nochmal
=
Console
.
ReadLine
();
}
while
(
nochmal
==
"j"
);
// Test in der Mitte
while
(
true
)
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
Console
.
Write
(
$"
{
i
,
3
}
"
);
}
Console
.
WriteLine
();
if
(
/* Test */
)
// Möglicher Schleifenabbruch
break
;
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
Console
.
Write
(
$"
{
i
}
"
);
}
}
}
}
}
02WeitereSchleifentypen/Properties/AssemblyInfo.cs
0 → 100644
View file @
6612cab2
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
(
"02WeitereSchleifentypen"
)]
[
assembly
:
AssemblyDescription
(
""
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
""
)]
[
assembly
:
AssemblyProduct
(
"02WeitereSchleifentypen"
)]
[
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
(
"7be593c7-4a69-46f2-9787-8e5e66664fcf"
)]
// 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"
)]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment