Commit 5e120505 authored by Uwe Wienkop's avatar Uwe Wienkop

Hangman

parent 1ae0a26b
<?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>{2786B97B-2DF5-4722-A927-8A064D47CE39}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>_11Hangman</RootNamespace>
<AssemblyName>11Hangman</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 _11Hangman
{
class Program
{
string[,]ausgabe={
{" ",
" xxxxxxxxxxxxxxxxxxxxxxx ",
" x | ",
" x O "}
};
static void Main(string[] args)
{
string[] namen = { "Anton", "Berta", "Claudia", "Dieter", "Emil", "Laura" };
Random R = new Random();
string suchwort = namen[R.Next(namen.Length)].ToLower();
char[] geheim = new char[suchwort.Length];
for (int i = 0; i < geheim.Length; i++)
geheim[i] = '-';
bool fertig;
do
{
for (int i = 0; i < geheim.Length; i++)
Console.Write($"{geheim[i],2}");
Console.WriteLine();
string eingabe = Console.ReadLine();
if (eingabe.Length != 1)
{
if (eingabe == suchwort)
{
Console.WriteLine("Richtig getippt");
break;
}
else
Console.WriteLine("Leider falsch");
}
else
{
for (int i = 0; i < geheim.Length; i++)
{
if (suchwort[i] == eingabe[0])
geheim[i] = suchwort[i];
}
}
fertig = true;
for (int i = 0; i < geheim.Length; i++)
{
if (geheim[i] == '-')
{
fertig = false;
break;
}
}
} while (!fertig);
}
}
}
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("11Hangman")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("11Hangman")]
[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("2786b97b-2df5-4722-a927-8a064d47ce39")]
// 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")]
......@@ -43,9 +43,16 @@ namespace _11KlasseDVD_WS1415
{
foreach (DVD dvd in dvdFeld)
{
if (dvd.Genre == genre &&
dvd.Darsteller.Contains(darsteller))
return dvd;
if (dvd.Genre == genre)
{
foreach (string name in dvd.darsteller)
{
if (name == darsteller)
return dvd;
}
}
//dvd.Darsteller.Contains(darsteller))
//return dvd;
}
return null;
}
......@@ -56,7 +63,7 @@ namespace _11KlasseDVD_WS1415
{
string[] darst = { "keineAhnung", "Depp" };
DVD[] dvdfeld = {
new DVD(Genre.Drama,"Karibik",darst),
new DVD(Genre.Drama,"Fluch der Karibik",darst),
new DVD(Genre.SciFi,"StarWars","R2D2","C3PO")
};
DVD.Suche(dvdfeld, "R2D2", Genre.SciFi);
......
......@@ -13,20 +13,20 @@ namespace _11Suchen
string gefunden=null;
foreach (string name in namen)
{
if (name.Contains(text)==true)
if (name.Contains(text))
{
gefunden = name;
break;
//break;
}
//else // ACHTUNG!!! Kein else nötig und sogar sehr gefährlich,
// // denn ohne Break wäre das Programm FALSCH!
// gefunden = "";
// gefunden = null;
}
return gefunden;
}
static void Main(string[] args)
{
string[] sfeld = { "Anton", "Berta", "Claudia", "Dieter", "Emil" };
string[] sfeld = { "Anton", "Berta", "Claudia", "Dieter", "Emil" ,"Laura"};
Console.WriteLine(Suchen(sfeld,"au"));
}
}
......
......@@ -95,6 +95,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "11Suchen", "11Suchen\11Such
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "11Klimaerwaermung", "11Klimaerwaermung\11Klimaerwaermung.csproj", "{E5A64563-1C88-4C05-9298-AE03A93D1E49}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "11Hangman", "11Hangman\11Hangman.csproj", "{2786B97B-2DF5-4722-A927-8A064D47CE39}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -273,6 +275,10 @@ Global
{E5A64563-1C88-4C05-9298-AE03A93D1E49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5A64563-1C88-4C05-9298-AE03A93D1E49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5A64563-1C88-4C05-9298-AE03A93D1E49}.Release|Any CPU.Build.0 = Release|Any CPU
{2786B97B-2DF5-4722-A927-8A064D47CE39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2786B97B-2DF5-4722-A927-8A064D47CE39}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2786B97B-2DF5-4722-A927-8A064D47CE39}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2786B97B-2DF5-4722-A927-8A064D47CE39}.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