<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>U-Labs Community - Aufgaben</title>
		<link>https://u-labs.de/forum/</link>
		<description>Verfasse eigens erstellte Programmier-Aufgaben für die User.</description>
		<language>de</language>
		<lastBuildDate>Tue, 05 May 2026 04:08:33 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>1</ttl>
		<image>
			<url>https://u-labs.de/forum/images/ulabs/misc/rss.png</url>
			<title>U-Labs Community - Aufgaben</title>
			<link>https://u-labs.de/forum/</link>
		</image>
		<item>
			<title>Anfänger PHP Langsames Skript</title>
			<link>aufgaben-160/php-langsames-skript-25721?goto=newpost</link>
			<pubDate>Wed, 14 Aug 2013 15:37:06 GMT</pubDate>
			<description>Heute mal eine wirklich sinnlose Aufgabe. Es darum darum ein möglichst *langsames* Skript zu schreiben. 
 
Das Skript, das ihr bearbeiten sollt sieht...</description>
			<content:encoded><![CDATA[<div>Heute mal eine wirklich sinnlose Aufgabe. Es darum darum ein möglichst <b>langsames</b> Skript zu schreiben.<br />
<br />
Das Skript, das ihr bearbeiten sollt sieht so aus:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP-Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$text&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'U-Hacks'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$start&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">microtime</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">#&nbsp;Hier&nbsp;den&nbsp;ganzen&nbsp;Code&nbsp;einfügen<br /><br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">$text</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$ende&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">microtime</span><span style="color: #007700">();<br /><br />echo&nbsp;</span><span style="color: #DD0000">"&lt;br&gt;"</span><span style="color: #007700">,</span><span style="color: #0000BB">$ende</span><span style="color: #007700">-</span><span style="color: #0000BB">$start</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></code><hr />
</div>Am Ende soll der gleichen Text wie $text ausgegeben werden, was ihr damit anstellt bleibt euch überlassen. <br />
<br />
Dabei gibt es Folgendes zu beachten:<br />
<ul><li style="">jede Funktion darf max. 2-mal verwendet werden (z.B. strstr, explode, implode usw.)</li><li style="">Keine Schleifen, die unnötig oft durchlaufen werden</li><li style="">Keine Verzögerung durch sleep, usleep uzw</li><li style="">Generell nichts, was das Skript irgendwie aufhalten könnte</li></ul><br />
<br />
Als Antwort bitte euer vollständiges Skript und den Durchschnitt der Zeit bei fünf Durchläufen posten.<br />
<br />
Have fun :D</div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>Snees</dc:creator>
			<guid isPermaLink="true">aufgaben-160/php-langsames-skript-25721</guid>
		</item>
		<item>
			<title>Anfänger Pig Latin Übersetzer (simple Version)</title>
			<link>aufgaben-160/pig-latin-uebersetzer-simple-version-25689?goto=newpost</link>
			<pubDate>Tue, 13 Aug 2013 15:44:29 GMT</pubDate>
			<description><![CDATA[Guten Tag, 
da es in meinen Augen hier viel zu wenig Aufgaben gibt,  
habe ich mich nun von der Seite "Codecademy" inspirieren lassen 
und einen "Pig...]]></description>
			<content:encoded><![CDATA[<div>Guten Tag,<br />
da es in meinen Augen hier viel zu wenig Aufgaben gibt, <br />
habe ich mich nun von der Seite &quot;<i>Codecademy</i>&quot; inspirieren lassen<br />
und einen &quot;Pig Latin Übersetzer&quot; (der Teil der dortigen Aufgabe war)<br />
geschrieben.<br />
<br />
<b>Erklärung</b><br />
Bei Wörtern, die mit einem Vokal anfangen, wird einfach nur ein &quot;ay&quot; angehangen.<br />
Bei Wörtern, die mit einem Konsonant anfangen, wird der Konsonant ans Ende des Wortes angehangen und dann<br />
&quot;ay&quot; dahintergesetzt.<br />
<br />
<br />
<i>(Konsonant)</i> Python -&gt; ythonpay<br />
<i>(Vokal)</i> Imperativ -&gt; imperativay<br />
<br />
<a href="http://en.wikipedia.org/wiki/Pig_Latin" target="_blank" rel="nofollow">Weiterführendes (Wiki)</a><br />
<i>(Natürlich steht es euch frei, die kompletten Regeln so zu übernehmen, wie sie in der Wikipedia stehen.)</i><br />
<br />
<br />
<b>Aufgabe:</b><br />
Schreibe einen (simplen) Pig Latin Übersetzer, der prüft ob das eingegebene Wort nur aus Buchstaben besteht, Konsonanten von Vokalen unterscheiden kann<br />
und dann die Übersetzung vornimmt.<br />
<br />
<br />
<b>Lösung: (Python)</b><br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<div class="bbcode_container">
	<div class="bbcode_description">PHP-Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB">def&nbsp;PigLatin</span><span style="color: #007700">():<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">pig&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"ay"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">original&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">input</span><span style="color: #007700">(</span><span style="color: #DD0000">"Geben&nbsp;Sie&nbsp;ein&nbsp;Wort&nbsp;ein:&nbsp;"</span><span style="color: #007700">)&nbsp;<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;</span><span style="color: #0000BB">len</span><span style="color: #007700">(</span><span style="color: #0000BB">original</span><span style="color: #007700">)&nbsp;&gt;&nbsp;</span><span style="color: #0000BB">0&nbsp;</span><span style="color: #007700">and&nbsp;</span><span style="color: #0000BB">original</span><span style="color: #007700">.</span><span style="color: #0000BB">isalpha</span><span style="color: #007700">():&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">word&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">original</span><span style="color: #007700">.</span><span style="color: #0000BB">lower</span><span style="color: #007700">()&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">first&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">word</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">0</span><span style="color: #007700">&#93;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;</span><span style="color: #0000BB">first&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">'a'&nbsp;</span><span style="color: #007700">or&nbsp;</span><span style="color: #0000BB">first&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">'e'&nbsp;</span><span style="color: #007700">or&nbsp;</span><span style="color: #0000BB">first&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">'i'&nbsp;</span><span style="color: #007700">or&nbsp;</span><span style="color: #0000BB">first&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">'o'&nbsp;</span><span style="color: #007700">or&nbsp;</span><span style="color: #0000BB">first&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">'u'</span><span style="color: #007700">:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">new_word&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">word&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">pig<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">print(</span><span style="color: #0000BB">new_word</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">PigLatin</span><span style="color: #007700">()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">new_word&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">word</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">1</span><span style="color: #007700">:&#93;&nbsp;+&nbsp;</span><span style="color: #0000BB">word</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">0</span><span style="color: #007700">&#93;&nbsp;+&nbsp;</span><span style="color: #0000BB">pig&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">print(</span><span style="color: #0000BB">new_word</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">PigLatin</span><span style="color: #007700">()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;else:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(</span><span style="color: #DD0000">"Falsche&nbsp;Eingabe.&nbsp;Versuchen&nbsp;Sie&nbsp;es&nbsp;erneut."</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">PigLatin</span><span style="color: #007700">()<br /><br /></span><span style="color: #0000BB">PigLatin</span><span style="color: #007700">()&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div>
</div>
</div>
</div><br />
<br />
<br />
<br />
Gruß<br />
<br />
Imperativ</div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>Imperativ</dc:creator>
			<guid isPermaLink="true">aufgaben-160/pig-latin-uebersetzer-simple-version-25689</guid>
		</item>
		<item>
			<title>Anfänger Einfacher Taschenrechner</title>
			<link>aufgaben-160/einfacher-taschenrechner-21547?goto=newpost</link>
			<pubDate>Sun, 17 Mar 2013 15:36:35 GMT</pubDate>
			<description>*Schwierigkeit*: Bild: http://u-img.net/img/2903Yd.png  
*Aufgabenstellung*: 
Es soll ein kleiner konsolenbasierter Taschenrechner für die...</description>
			<content:encoded><![CDATA[<div><b>Schwierigkeit</b>: <img src="http://u-img.net/img/2903Yd.png" border="0" alt="" /><br />
<b>Aufgabenstellung</b>:<br />
Es soll ein kleiner konsolenbasierter Taschenrechner für die Grundrechenarten +, -, * und / programmiert werden. <br />
Fürs dividieren sollen zwei Operatoren zur Verfügung stehen: <br />
/ Teilt die Zahl mit dezimalem Ergebnis (Beispiel: 7 / 2 = 3,5)<br />
: Teilt die Zahl mit Ausgabe des Restes (Beispiel: 7 : 2 = 3 Rest 1)<br />
<br />
Lösung (C++)<br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<script type="text/javascript" src="clientscript/syntaxhighlighter/shCore.js"></script>
<script type="text/javascript" src="clientscript/syntaxhighlighter/shBrushCpp.js"></script>
<link type="text/css" rel="stylesheet" href="clientscript/syntaxhighlighter/styles/shCoreDefault.css"/>

<pre class="brush: cpp;">
<br />
#include &lt;iostream&gt;<br />
#include &lt;conio&gt;<br />
<br />
using namespace std;<br />
<br />
void main() {<br />
     cout &lt;&lt; &quot;Erste Zahl eingeben: &quot;;<br />
     float Operand1;<br />
     cin &gt;&gt; Operand1;<br />
<br />
     cout &lt;&lt; &quot;Operator eingeben (G&quot; &lt;&lt; char(129) &lt;&lt; &quot;ltig: +, -, *, /, :): &quot;;<br />
     char Operator;<br />
     cin &gt;&gt; Operator;<br />
<br />
     cout &lt;&lt; &quot;Zweite Zahl eingeben: &quot;;<br />
     float Operand2;<br />
     cin &gt;&gt; Operand2;<br />
<br />
     switch(Operator) {<br />
                      case '+':<br />
                           cout &lt;&lt; Operand1 + Operand2;<br />
                           break;<br />
<br />
                      case '-':<br />
                           cout &lt;&lt; Operand1 - Operand2;<br />
                           break;<br />
<br />
                      case '*':<br />
                           cout &lt;&lt; Operand1 * Operand2;<br />
                           break;<br />
<br />
                      case '/':<br />
                           if(Operand2 == 0) {<br />
                                       cout &lt;&lt; &quot;Division durch 0 nicht m&quot; &lt;&lt; char(148) &lt;&lt; &quot;glich!&quot;;<br />
                                       getch();<br />
                                       return;<br />
                           }<br />
                           else {<br />
                                 cout &lt;&lt; Operand1 / Operand2;<br />
                           }<br />
                           break;<br />
<br />
                      case ':':<br />
                           if(Operand2 == 0){<br />
                                       cout &lt;&lt; &quot;Division durch 0 nicht m&quot; &lt;&lt; char(148) &lt;&lt; &quot;glich!&quot;;<br />
                                       getch();<br />
                                       return;<br />
                           }<br />
                           else if((int)Operand1 != Operand1 || (int)Operand2 != Operand2) {<br />
                                 cout &lt;&lt; &quot;Nur ganzzahlige Operanden m&quot; &lt;&lt; char(148) &lt;&lt; &quot;glich!&quot;;<br />
                                 getch();<br />
                                 return;<br />
                           }<br />
                           else {<br />
                                 cout &lt;&lt; (int)(Operand1 / Operand2) &lt;&lt; &quot; Rest &quot; &lt;&lt; (int)Operand1 % (int)Operand2;<br />
                           }<br />
                           break;<br />
<br />
                      default:<br />
                              cout &lt;&lt; &quot;Ung&quot; &lt;&lt; char(129) &lt;&lt; &quot;ltiger Operator!&quot; &lt;&lt; Operator;<br />
                              getch();<br />
                              return;<br />
                              break;<br />
     }<br />
<br />
     getch();<br />
}<br />

</pre>
<script type="text/javascript">
SyntaxHighlighter.config.stripBrs = true;
SyntaxHighlighter.all();
</script><br />

</div>
</div>
</div></div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>DMW007</dc:creator>
			<guid isPermaLink="true">aufgaben-160/einfacher-taschenrechner-21547</guid>
		</item>
		<item>
			<title>Anfänger Brüche Kürzen</title>
			<link>aufgaben-160/brueche-kuerzen-21545?goto=newpost</link>
			<pubDate>Sun, 17 Mar 2013 15:18:56 GMT</pubDate>
			<description>*Schwierigkeit*: Bild: http://u-img.net/img/2903Yd.png  Bild: http://u-img.net/img/2903Yd.png  
*Aufgabenstellung*:  
Es soll ein konsolenbasiertes...</description>
			<content:encoded><![CDATA[<div><b>Schwierigkeit</b>: <img src="http://u-img.net/img/2903Yd.png" border="0" alt="" /> <img src="http://u-img.net/img/2903Yd.png" border="0" alt="" /><br />
<b>Aufgabenstellung</b>: <br />
Es soll ein konsolenbasiertes Programm entwickelt werden, dass einen Bruch so weit wie möglich kürzt.<br />
Beispiele: <br />
2/4 =&gt; 1/2<br />
15/6 =&gt; 5/2<br />
Das Kürzen selbst soll in einer externen Klasse vorgenommen werden.<br />
Zur Übergabe der Parameter an die Funktionen sollen Referenzparameter (Zeiger) genutzt werden.<br />
Außerdem sollen die Daten des Bruchs als private Variablen in der Klasse hinterlegt werden.<br />
<br />
<b>Lösung (C++):</b><br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<br />
<b>Testprogramm</b>:<br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<script type="text/javascript" src="clientscript/syntaxhighlighter/shCore.js"></script>
<script type="text/javascript" src="clientscript/syntaxhighlighter/shBrushCpp.js"></script>
<link type="text/css" rel="stylesheet" href="clientscript/syntaxhighlighter/styles/shCoreDefault.css"/>

<pre class="brush: cpp;">
<br />
#include &lt;iostream&gt;<br />
#include &lt;conio&gt;<br />
#include &quot;Bruch.h&quot;<br />
<br />
using namespace std;<br />
<br />
void main() {<br />
    int zaehler = 0;<br />
    int nenner = 0;<br />
<br />
    cout &lt;&lt; &quot;Zu kuerzender Bruch:\n\n&quot;;<br />
    cin &gt;&gt; zaehler;<br />
    cout &lt;&lt; &quot;---\n&quot;;<br />
    cin &gt;&gt; nenner;<br />
<br />
    Bruch bruch;<br />
    bruch.WertSetzen(&amp;zaehler, &amp;nenner);<br />
    bruch.Kuerzen();<br />
    bruch.WertLesen(&amp;zaehler, &amp;nenner);<br />
<br />
    cout &lt;&lt; &quot;\n\nGekuerzter Bruch:\n\n&quot;;<br />
    cout &lt;&lt; zaehler &lt;&lt; endl;<br />
    cout &lt;&lt; &quot;---\n&quot;;<br />
    cout &lt;&lt; nenner;<br />
<br />
    getch();<br />
}<br />

</pre>
<script type="text/javascript">
SyntaxHighlighter.config.stripBrs = true;
SyntaxHighlighter.all();
</script><br />

</div>
</div>
</div><br />
<br />
<b>Headerdatei Bruch.h</b>:<br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<script type="text/javascript" src="clientscript/syntaxhighlighter/shCore.js"></script>
<script type="text/javascript" src="clientscript/syntaxhighlighter/shBrushCpp.js"></script>
<link type="text/css" rel="stylesheet" href="clientscript/syntaxhighlighter/styles/shCoreDefault.css"/>

<pre class="brush: cpp;">
<br />
#ifndef _BRUCH_H<br />
#define _BRUCH_H<br />
<br />
class Bruch {<br />
<br />
    private:<br />
        int Zaehler;<br />
        int Nenner;<br />
        int GGT(int a, int b);<br />
<br />
    public:<br />
        void Kuerzen();<br />
        void WertLesen(int* pZaehler, int* pNenner);<br />
        void WertSetzen(int* pZaehler, int* pNenner);<br />
};<br />
<br />
#endif _BRUCH_H<br />

</pre>
<script type="text/javascript">
SyntaxHighlighter.config.stripBrs = true;
SyntaxHighlighter.all();
</script><br />

</div>
</div>
</div><br />
<br />
<b>Klasse Bruch.cpp</b>:<br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<script type="text/javascript" src="clientscript/syntaxhighlighter/shCore.js"></script>
<script type="text/javascript" src="clientscript/syntaxhighlighter/shBrushCpp.js"></script>
<link type="text/css" rel="stylesheet" href="clientscript/syntaxhighlighter/styles/shCoreDefault.css"/>

<pre class="brush: cpp;">
<br />
#include &quot;Bruch.h&quot;<br />
<br />
void Bruch::Kuerzen() {<br />
    if(Zaehler != 0 &amp;&amp; Nenner != 0) {<br />
        int ggt = GGT(Zaehler, Nenner);<br />
        Zaehler /= ggt;<br />
        Nenner /= ggt;<br />
    }<br />
}<br />
<br />
void Bruch::WertLesen(int* pZaehler, int* pNenner) {<br />
    *pZaehler = Zaehler;<br />
    *pNenner = Nenner;<br />
}<br />
<br />
void Bruch::WertSetzen(int* pZaehler, int* pNenner) {<br />
    Zaehler = *pZaehler;<br />
    Nenner = *pNenner;<br />
}<br />
<br />
int Bruch::GGT(int a, int b) {<br />
    if( b==0)<br />
    return a;<br />
    else<br />
    GGT(b, a % b);<br />
}<br />

</pre>
<script type="text/javascript">
SyntaxHighlighter.config.stripBrs = true;
SyntaxHighlighter.all();
</script><br />

</div>
</div>
</div><br />
<br />

</div>
</div>
</div></div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>DMW007</dc:creator>
			<guid isPermaLink="true">aufgaben-160/brueche-kuerzen-21545</guid>
		</item>
		<item>
			<title>Anfänger Siebzehn und Vier</title>
			<link>aufgaben-160/siebzehn-vier-21542?goto=newpost</link>
			<pubDate>Sun, 17 Mar 2013 15:00:51 GMT</pubDate>
			<description>*Schwierigkeit*: Bild: http://u-img.net/img/2903Yd.png  
*Aufgabenstellung*: 
Das Spiel Siebzehn und Vier soll vereinfacht als Konsolenanwendung...</description>
			<content:encoded><![CDATA[<div><b>Schwierigkeit</b>: <img src="http://u-img.net/img/2903Yd.png" border="0" alt="" /><br />
<b>Aufgabenstellung</b>:<br />
Das Spiel Siebzehn und Vier soll vereinfacht als Konsolenanwendung realisiert werden. <br />
Dazu wird beim Ziehen einer Karte eine Zufallszahl im Intervall [1; 11] generiert, die dann den Wert der gezogenen Karte darstellt. <br />
Nach jedem Zug hat der Nutzer die Möglichkeit, das Spiel zu beenden oder eine weitere Karte zu ziehen. <br />
Ziel des Spiels ist es, möglichst nah an 21 heran zu kommen. Erreicht man mehr als 21 Punkte, hat man verloren. <br />
<br />
<b>Beispielscreenshots aus der fertigen Anwendung:</b><br />
<br />
Verloren: <br />
<br />
<img src="https://u-labs.de/forum/attachment.php?attachmentid=3294&amp;d=1363532249" border="0" alt="Name:  17u4-loose.png
Hits: 1234
Größe:  28,4 KB" class="thumbnail" style="float:CONFIG" /><br />
<br />
Gewonnen: <br />
<br />
<img src="https://u-labs.de/forum/attachment.php?attachmentid=3295&amp;d=1363532297" border="0" alt="Name:  17u4-win.png
Hits: 1234
Größe:  29,8 KB" class="thumbnail" style="float:CONFIG" /><br />
<br />
<b><br />
Lösung (C++):</b><br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<script type="text/javascript" src="clientscript/syntaxhighlighter/shCore.js"></script>
<script type="text/javascript" src="clientscript/syntaxhighlighter/shBrushCpp.js"></script>
<link type="text/css" rel="stylesheet" href="clientscript/syntaxhighlighter/styles/shCoreDefault.css"/>

<pre class="brush: cpp;">
<br />
#include &lt;iostream&gt;<br />
#include &lt;conio&gt;<br />
using namespace std;<br />
<br />
void main() {<br />
    cout &lt;&lt; &quot;Ziehen Sie Karten, aber bleiben Sie unter 22 Punkten!\n&quot;;<br />
    cout &lt;&lt; &quot;Die Karten haben zwischen 1 und 11 Punkten.\n\n&quot;;<br />
<br />
    randomize();<br />
    int Karten = 0;<br />
    char Eingabe = ' ';<br />
    do {<br />
                int Zahl = 0;<br />
                do {<br />
                        Zahl = random(12);<br />
                }while(Zahl == 0);<br />
<br />
        Karten += Zahl;<br />
<br />
        if(Karten &lt; 22) {<br />
            cout &lt;&lt; &quot;Karte: &quot; &lt;&lt; Zahl &lt;&lt; &quot; Punkte. Weitere Karte ziehen? (j)? &quot;;<br />
            Eingabe = getch();<br />
        }else {<br />
            cout &lt;&lt; &quot;Karte: &quot; &lt;&lt; Zahl &lt;&lt; &quot; Punkte.&quot;;<br />
        }<br />
<br />
        cout &lt;&lt; endl;<br />
    } while(Eingabe == 'j' &amp;&amp; Karten &lt; 22);<br />
<br />
    if(Karten &lt; 22) {<br />
        cout &lt;&lt; &quot;\nSie haben mit &quot; &lt;&lt; Karten &lt;&lt; &quot; Punkten beendet.&quot;;<br />
    } else {<br />
        cout &lt;&lt; &quot;\nVERLOREN! Sie haben &quot; &lt;&lt; Karten &lt;&lt; &quot; Punkte!&quot;;<br />
    }<br />
<br />
    getch();<br />
}<br />

</pre>
<script type="text/javascript">
SyntaxHighlighter.config.stripBrs = true;
SyntaxHighlighter.all();
</script><br />

</div>
</div>
</div></div>


	<div style="padding:10px">

	

	
		<fieldset class="fieldset">
			<legend>Angehängte Grafiken</legend>
				<div style="padding:10px">
				<img class="attach" src="https://u-labs.de/forum/attachment.php?attachmentid=3294&amp;stc=1&amp;d=1363532249" alt="" />&nbsp;<img class="attach" src="https://u-labs.de/forum/attachment.php?attachmentid=3295&amp;stc=1&amp;d=1363532297" alt="" />&nbsp;
			</div>
		</fieldset>
	

	

	

	</div>
]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>DMW007</dc:creator>
			<guid isPermaLink="true">aufgaben-160/siebzehn-vier-21542</guid>
		</item>
		<item>
			<title>Anfänger Brainfuck-Interpreter</title>
			<link>aufgaben-160/brainfuck-interpreter-21371?goto=newpost</link>
			<pubDate>Mon, 11 Mar 2013 17:42:42 GMT</pubDate>
			<description>Hi, 
 
wieder eine Programmieraufgabe: es soll ein Interpreter für die esoterische Programmiersprache Brainfuck...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
wieder eine Programmieraufgabe: es soll ein Interpreter für die esoterische Programmiersprache <a href="http://de.wikipedia.org/wiki/Brainfuck" target="_blank" rel="nofollow">Brainfuck</a> programmiert werden. <br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>Meine Lösung (Java)</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">import java.io.IOException;<br />
import java.io.Reader;<br />
<br />
import java.util.Scanner;<br />
<br />
public final class BrainfuckInterpreter {<br />
&nbsp; &nbsp; &nbsp; &nbsp; private final String&nbsp; input;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private&nbsp; &nbsp; &nbsp;  int&nbsp; &nbsp;  inputPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private final short[] data;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private&nbsp; &nbsp; &nbsp;  short&nbsp;  dataPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public BrainfuckInterpreter(final Reader source) throws IOException {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; input&nbsp; &nbsp; = getInputAsString(source);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data&nbsp; &nbsp;  = new short[Short.MAX_VALUE];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputPtr = dataPtr = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public void interpret() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (; inputPtr &lt; input.length(); ++inputPtr) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (input.charAt(inputPtr)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '&gt;': ++dataPtr; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '&lt;': --dataPtr; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '+': ++data[dataPtr]; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '-': --data[dataPtr]; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '.': System.out.print((char) data[dataPtr]); break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case ',': data[dataPtr] = new Scanner(System.in).nextByte(); break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '[': if (data[dataPtr] == 0) handleLoop('['); break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case ']': handleLoop(']'); --inputPtr; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default: break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private void handleLoop(final char sign) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int brackets = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (brackets &gt; 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (input.charAt(sign == '[' ? ++inputPtr : --inputPtr)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '[': brackets += sign == '[' ?&nbsp; 1 : -1; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case ']': brackets += sign == '[' ? -1 :&nbsp; 1; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private String getInputAsString(final Reader source) throws IOException {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final StringBuilder output = new StringBuilder();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int current = source.read();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (current != -1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output.append((char) current);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current = source.read();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return output.toString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</code><hr />
</div>Benutzung:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">public final class BrainfuckInterpreterTest {<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args) throws FileNotFoundException, IOException {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final BrainfuckInterpreter bfinterpreter =<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new BrainfuckInterpreter(new FileReader(&quot;/home/tobi/test.bf&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bfinterpreter.interpret();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</code><hr />
</div>
</div>
</div>
</div><br />
<br />
Brainfuck-Codes zum Füttern des Interpreters:<br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>Hello World</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"> ++++++++++<br />
&nbsp;[<br />
&nbsp; &gt;+++++++&gt;++++++++++&gt;+++&gt;+&lt;&lt;&lt;&lt;-<br />
&nbsp;]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Schleife zur Vorbereitung der Textausgabe<br />
&nbsp;&gt;++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Ausgabe von 'H'<br />
&nbsp;&gt;+.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Ausgabe von 'e'<br />
&nbsp;+++++++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'l'<br />
&nbsp;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'l'<br />
&nbsp;+++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'o'<br />
&nbsp;&gt;++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Leerzeichen<br />
&nbsp;&lt;&lt;+++++++++++++++.&nbsp; &nbsp; &nbsp; 'W'<br />
&nbsp;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'o'<br />
&nbsp;+++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'r'<br />
&nbsp;------.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'l'<br />
&nbsp;--------.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'd'<br />
&nbsp;&gt;+.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  '!'<br />
&nbsp;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Zeilenvorschub<br />
&nbsp;+++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Wagenrücklauf</code><hr />
</div>Ausgabe:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">Hello World</code><hr />
</div>
</div>
</div>
</div><br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>99 Bottles of Beer</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"># 99 bottles of beer in Brainf*ck<br />
# Copyright (C) 2008 Raphael Bois<br />
# 1671 brainf*ck instructions.<br />
# Published under GPL v2<br />
<br />
Initialization<br />
++&nbsp; &nbsp; Counter for loop (a)<br />
&gt;+&nbsp; &nbsp; unused<br />
&gt;++&nbsp;  Counter for loop (b)<br />
&gt;&nbsp; &nbsp;  Flag for 'no more'<br />
&gt;+&nbsp; &nbsp; Flag for not 'no more'<br />
&gt;&gt;&gt;&nbsp;  (5) to (7) : temporary values<br />
++++++++++[-&gt;+&gt;+&gt;++++++++++&lt;&lt;&lt;]&gt;&gt;&gt;&nbsp; &nbsp; 10 10 100 in (8) (9) (10)<br />
&gt;++++++++++&nbsp;  10 in (11)<br />
[-<br />
&nbsp;  &gt;+++++&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  50&nbsp; in (12)<br />
&nbsp;  &gt;++++++++++&nbsp; &nbsp; &nbsp; 100 in (13)<br />
&nbsp;  &gt;+++++++++++&nbsp; &nbsp;  110 in (14)<br />
&nbsp;  &gt;++++++++&nbsp; &nbsp; &nbsp; &nbsp; 80&nbsp; in (15)<br />
&nbsp;  &gt;++++++++&nbsp; &nbsp; &nbsp; &nbsp; 80&nbsp; in (16)<br />
&nbsp;  &gt;+++&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30&nbsp; in (17)<br />
&nbsp;  &gt;++++&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 40&nbsp; in (18)<br />
&nbsp;  &gt;+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  10&nbsp; in (19)<br />
&nbsp;  &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;]<br />
+<br />
&gt;-- +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  48&nbsp; '0'&nbsp;  plus 1 in (12)<br />
&gt;++ +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  102 'f'&nbsp;  plus 1 in (13)<br />
&gt;+++++ +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 115 's'&nbsp;  plus 1 in (14)<br />
&gt;-- +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  78&nbsp; 'N'&nbsp;  plus 1 in (15)<br />
&gt;++++ +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  84&nbsp; 'T'&nbsp;  plus 1 in (16)<br />
&gt;++ +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  32&nbsp; ' '&nbsp;  plus 1 in (17)<br />
&gt;++++ +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  44&nbsp; comma plus 1 in (18)<br />
&gt; +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  10&nbsp; LF&nbsp; &nbsp; plus 1 in (19)<br />
<br />
stuff for writing parts of the song<br />
&gt;+&nbsp;  select stuff<br />
&gt;+&nbsp;  select stuff<br />
&gt;+&nbsp;  write song part 3<br />
&gt;++&nbsp; write song part 1<br />
&gt;+&nbsp;  write song part 2<br />
&gt;+&nbsp;  Flag for 'end of song'<br />
&gt;++&nbsp; Flag for not 'end of song'<br />
<br />
All bytes are at val plus 1<br />
Go back to (7) with final initialization step (remove 1 to all bytes)<br />
[-&lt;]<br />
<br />
&lt;&lt;&lt;&lt;&lt;&lt;&lt; at (0)<br />
[ loop (a)<br />
-<br />
<br />
&gt;&gt; at (2)<br />
[ loop (b)<br />
<br />
&nbsp; &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; at (10)<br />
&nbsp; [ start loop<br />
<br />
&nbsp; &nbsp; &lt;&lt;&lt;&lt;&lt;&lt;&lt; at (3)<br />
&nbsp; &nbsp; [-&gt;[-]<br />
&nbsp; &nbsp; &nbsp; print '(N|n)o more'<br />
&nbsp; &nbsp; &nbsp; &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;.&nbsp; '(N|n)'<br />
&nbsp; &nbsp; &nbsp; &lt;----.&nbsp; &nbsp; &nbsp; &nbsp; 'o'<br />
&nbsp; &nbsp; &nbsp; &gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &nbsp; &lt;&lt;&lt;--.&nbsp; &nbsp; &nbsp; &nbsp; 'm'<br />
&nbsp; &nbsp; &nbsp; ++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'o'<br />
&nbsp; &nbsp; &nbsp; +++.+&nbsp; &nbsp; &nbsp; &nbsp;  'r'<br />
&nbsp; &nbsp; &nbsp; &lt;-.+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'e'<br />
&nbsp; &nbsp; &nbsp; &lt;&lt;+&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br />
&nbsp; &nbsp; ]+&gt; at (4)<br />
&nbsp; &nbsp; [-&lt;[-]&gt;&gt;&gt;&gt;&gt; at (9)<br />
&nbsp; &nbsp; &nbsp; prints number (using (9) and (10))<br />
&nbsp; &nbsp; &nbsp; [&gt;&gt;&gt;+&lt;&lt;&lt;&lt;+&lt;+&lt;+&gt;&gt;&gt;-]&lt;&lt;&lt;[-&gt;&gt;&gt;+&lt;&lt;&lt;]&gt; at (6)<br />
&nbsp; &nbsp; &nbsp; [&gt;&gt;&gt;&gt;&gt;&gt;+&lt;&lt;&lt;&lt;&lt;&lt;-]&gt;&gt;&gt;&gt;&gt;[[-]&gt;.&lt;]&lt;&lt;&lt;&lt;[&gt;&gt;&gt;&gt;&gt;-&lt;&lt;&lt;&lt;&lt;-]&gt;&gt; at (9)<br />
&nbsp; &nbsp; &nbsp; [&lt;&lt;+&lt;+&lt;+&gt;&gt;&gt;&gt;-]&lt;&lt;&lt;&lt;[-&gt;&gt;&gt;&gt;+&lt;&lt;&lt;&lt;]&gt; at (6)<br />
&nbsp; &nbsp; &nbsp; [&gt;&gt;&gt;&gt;&gt;&gt;+&lt;&lt;&lt;&lt;&lt;&lt;-]&gt;&gt;&gt;&gt;&gt;&gt;.&lt;&lt;&lt;&lt;&lt;[&gt;&gt;&gt;&gt;&gt;-&lt;&lt;&lt;&lt;&lt;-] at (7)<br />
<br />
&nbsp; &nbsp; &nbsp; memorize in (11) if (10) not 1<br />
&nbsp; &nbsp; &nbsp; &gt;&gt;&gt;[-&lt;&lt;&lt;+&lt;+&gt;&gt;&gt;&gt;]&lt;&lt;&lt;&lt;[-&gt;&gt;&gt;&gt;+&lt;&lt;&lt;&lt;]&gt;-[[-]&gt;&gt;&gt;&gt;+&lt;&lt;&lt;&lt;]&lt;&lt;&lt; at (4)<br />
&nbsp; &nbsp; ]+<br />
<br />
&nbsp; &nbsp; &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; at (12)<br />
&nbsp; &nbsp; print ' bottle(s) of beer'<br />
&nbsp; &nbsp; &gt;&gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &lt;&lt;&lt;&lt;----.&nbsp; &nbsp; 'b'<br />
&nbsp; &nbsp; &gt;----.&nbsp; &nbsp; &nbsp;  'o'<br />
&nbsp; &nbsp; +++++..-&nbsp; &nbsp;  'tt'<br />
&nbsp; &nbsp; &lt;++++++++++. 'l'<br />
&nbsp; &nbsp; -------.&nbsp; &nbsp;  'e'<br />
&nbsp; &nbsp; &lt;&lt;[[-]&gt;&gt;&gt;.&lt;&lt;&lt;]&gt;&gt; 's' if (11)==1 ie if (10)!=1<br />
&nbsp; &nbsp; &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &lt;&lt;&lt;----.&nbsp; &nbsp;  'o'<br />
&nbsp; &nbsp; &lt;+.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'f'<br />
&nbsp; &nbsp; &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &lt;&lt;&lt;&lt;----.&nbsp; &nbsp; 'b'<br />
&nbsp; &nbsp; +++..+&nbsp; &nbsp; &nbsp;  'ee'<br />
&nbsp; &nbsp; &gt;+++.+&nbsp; &nbsp; &nbsp;  'r'<br />
<br />
&nbsp; &nbsp; [&gt;] at (20)<br />
<br />
&nbsp; &nbsp; +&gt;+&gt;[-&gt;+&lt;&lt;-&lt;-<br />
&nbsp; &nbsp; &nbsp; &nbsp;  print ' on the wall' DOT LF LF<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;----.&nbsp; &nbsp; &nbsp; &nbsp; 'o'<br />
&nbsp; &nbsp; &nbsp; &nbsp;  -.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'n'<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;++++++.&nbsp; &nbsp; &nbsp; 't'<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &lt;++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'h'<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ---.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'e'<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;+++.&nbsp; &nbsp; &nbsp; &nbsp;  'w'<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &lt;----.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'a'<br />
&nbsp; &nbsp; &nbsp; &nbsp;  +++++++++++..&nbsp;  'll'<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ------&gt;----&nbsp; &nbsp;  reset to 'f' and 's'<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &gt;---------- ---------- ---------- -- sets (15) to 'N'<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;++.--&nbsp; DOT<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &gt;..&nbsp; &nbsp; &nbsp;  LF LF<br />
&nbsp; &nbsp; &gt;&gt;&gt;] at (22)<br />
<br />
&nbsp; &nbsp; &gt;&gt;&gt;[-&gt;[-]&lt;&lt;&lt;&lt;&lt;&lt;&lt;[&lt;]&lt;[-]&gt;&gt;[&gt;]&gt;&gt;&gt;&gt;&gt;]+ if end of song reset bottles counter<br />
&nbsp; &nbsp; &gt;[-&lt;[-] at (25)<br />
&nbsp; &nbsp; &nbsp; &lt;&lt;&lt;&lt; at (21)<br />
&nbsp; &nbsp; &nbsp; [-&gt;&gt;[-&gt;+&lt;&lt;&lt;&lt;-<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  print ' on the wall' COMMA ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;----.&nbsp; &nbsp; &nbsp; &nbsp; 'o'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  -.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'n'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;++++++.&nbsp; &nbsp; &nbsp; 't'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'h'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ---.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'e'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;+++.&nbsp; &nbsp; &nbsp; &nbsp;  'w'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;----.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'a'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  +++++++++++..&nbsp;  'll'<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ------&gt;----&nbsp; &nbsp;  reset (13) and (14) to 'f' and 's'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;++++++++++ ++++++++++ ++++++++++ ++ sets (15) to 'n'<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; comma<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &nbsp; &gt;&gt;&gt;&gt;&gt;&gt;]&lt;&lt;]&lt; at (20)<br />
<br />
&nbsp; &nbsp; &nbsp; [-&gt;&gt;&gt;&gt;[-&lt;&lt;+&lt; at (21)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;++.--&nbsp; &nbsp; &nbsp;  DOT<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  LF<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  [&lt;]&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; at (3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  [-&gt;[-]&lt;]+&gt;&nbsp; at (4)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  [-&lt;[-]&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;.&nbsp; 'T'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;-----.&nbsp; &nbsp; &nbsp; 'a'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ++++++++++.&nbsp; &nbsp; 'k'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ------.&nbsp; &nbsp; &nbsp; &nbsp; 'e'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;----.&nbsp; &nbsp; &nbsp;  'o'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  -.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'n'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'e'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;&lt;-.&nbsp; &nbsp; &nbsp; &nbsp;  'd'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;+.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'o'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ++++++++.&nbsp; &nbsp; &nbsp; 'w'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ---------.&nbsp; &nbsp;  'n'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;&lt;---.&nbsp; &nbsp; &nbsp;  'a'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'n'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;+++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'd'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;++.&nbsp; &nbsp; &nbsp; &nbsp;  'p'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;---.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'a'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;+++..&nbsp; &nbsp; &nbsp; &nbsp;  'ss'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;&lt;++++++++.&nbsp; 'i'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;+.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 't'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ' '<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;&lt;&lt;&lt;--------.&nbsp; 'a'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;--.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'r'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ---.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'o'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ++++++.&nbsp; &nbsp; &nbsp; &nbsp; 'u'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  -------.&nbsp; &nbsp; &nbsp;  'n'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;+++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'd'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ++&gt;+++++&nbsp; &nbsp; &nbsp;  reset (13) and (14) to 'f' and 's'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; comma<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ' '<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  [&lt;]&lt;&lt;&lt;&lt;&lt;&lt;&lt; at (4)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ]+<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt;&gt;&gt;&gt;&gt; at (10)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; decrements values<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&lt;&lt;&lt;+&gt;&gt;[&lt;&lt;[-]&lt;+&lt;+&gt;&gt;&gt;&gt;-]&lt;&lt;&lt;&lt;[&gt;-&lt;[-]]&gt;[-&gt;&gt;&gt;+&lt;&lt;&lt;]&gt;[-&gt;-&gt;+++++++++&lt;&lt;]&gt;&gt;&gt; at (10)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &gt;&gt;[&gt;]&gt;&gt;&gt;&gt;] at (24)<br />
&nbsp; &nbsp; &nbsp; &lt;&lt;&lt;&lt;] at (20)<br />
<br />
&nbsp; &nbsp; &gt;&gt;&gt;&gt;&gt;&gt;]+ at (26)<br />
<br />
&nbsp; &nbsp; &lt;&lt;&lt;&lt;&lt;&lt;&lt;[&lt;]&lt; at (10)<br />
&nbsp; ]<br />
&nbsp; +&lt;+<br />
&nbsp; &lt;&lt;&lt;&lt;&lt;&lt;+&lt; at (2)<br />
&nbsp; -<br />
]<br />
<br />
print 'Go to the store and buy some more' comma ' '<br />
<br />
&nbsp; &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;[&gt;]&gt;&gt;&gt;&gt;&gt; at (25)<br />
&nbsp; [-&gt;[-]&lt;]+&gt; at (26)<br />
&nbsp; [-&lt;[-]<br />
&nbsp; &nbsp; &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; at (16)<br />
&nbsp; &nbsp; -------------.&nbsp;  'G'<br />
&nbsp; &nbsp; &lt;&lt;----.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'o'<br />
&nbsp; &nbsp; &gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ' '<br />
&nbsp; &nbsp; &lt;&lt;&lt;+++++.&nbsp; &nbsp; &nbsp; &nbsp; 't'<br />
&nbsp; &nbsp; -----.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'o'<br />
&nbsp; &nbsp; &gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ' '<br />
&nbsp; &nbsp; &lt;&lt;&lt;+++++.&nbsp; &nbsp; &nbsp; &nbsp; 't'<br />
&nbsp; &nbsp; &lt;++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'h'<br />
&nbsp; &nbsp; ---.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'e'<br />
&nbsp; &nbsp; &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &lt;&lt;&lt;-.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 's'<br />
&nbsp; &nbsp; +.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  't'<br />
&nbsp; &nbsp; -----.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'o'<br />
&nbsp; &nbsp; +++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'r'<br />
&nbsp; &nbsp; &lt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'e'<br />
&nbsp; &nbsp; &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &lt;&lt;&lt;&lt;----.&nbsp; &nbsp; &nbsp; &nbsp; 'a'<br />
&nbsp; &nbsp; &gt;----.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'n'<br />
&nbsp; &nbsp; &lt;+++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'd'<br />
&nbsp; &nbsp; &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &lt;&lt;&lt;&lt;--.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'b'<br />
&nbsp; &nbsp; &gt;+++++++.&nbsp; &nbsp; &nbsp; &nbsp; 'u'<br />
&nbsp; &nbsp; ++++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'y'<br />
&nbsp; &nbsp; &gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ' '<br />
&nbsp; &nbsp; &lt;&lt;&lt;------.&nbsp; &nbsp; &nbsp;  's'<br />
&nbsp; &nbsp; ----.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'o'<br />
&nbsp; &nbsp; --.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'm'<br />
&nbsp; &nbsp; &lt;+++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'e'<br />
&nbsp; &nbsp; &gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' '<br />
&nbsp; &nbsp; &lt;&lt;&lt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'm'<br />
&nbsp; &nbsp; ++.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'o'<br />
&nbsp; &nbsp; +++.+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'r'<br />
&nbsp; &nbsp; &lt;.+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'e'<br />
&nbsp; &nbsp; &gt;&gt;&gt;&gt;&gt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  coma<br />
&nbsp; &nbsp; &lt;.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ' '<br />
&nbsp; &nbsp; &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br />
&nbsp; ]+<br />
<br />
&nbsp; Initialize last loop to print final '99 bottles of beer on the wall' DOT<br />
&nbsp; &lt;[-]+&lt;[-]&lt;[-]&lt;[-]+&lt;&lt;&lt; at (19)<br />
&nbsp; [&lt;]&lt;[-]&lt;[-]&lt;[-]&lt;[-] at (7)<br />
&nbsp; ++++++++++[-&gt;+&gt;+&gt;++++++++++&lt;&lt;&lt;]&gt;-&gt;-&gt;-<br />
&nbsp; &lt;&lt;&lt;&lt;&lt;&lt;[-]+&lt;[-]&lt;+&lt;&lt; at (0)<br />
]</code><hr />
</div>Ausgabe:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">99 bottles of beer on the wall, 99 bottles of beer.<br />
Take one down and pass it around, 98 bottles of beer on the wall.<br />
<br />
98 bottles of beer on the wall, 98 bottles of beer.<br />
Take one down and pass it around, 97 bottles of beer on the wall.<br />
<br />
97 bottles of beer on the wall, 97 bottles of beer.<br />
Take one down and pass it around, 96 bottles of beer on the wall.<br />
<br />
96 bottles of beer on the wall, 96 bottles of beer.<br />
Take one down and pass it around, 95 bottles of beer on the wall.<br />
<br />
95 bottles of beer on the wall, 95 bottles of beer.<br />
Take one down and pass it around, 94 bottles of beer on the wall.<br />
<br />
94 bottles of beer on the wall, 94 bottles of beer.<br />
Take one down and pass it around, 93 bottles of beer on the wall.<br />
<br />
93 bottles of beer on the wall, 93 bottles of beer.<br />
Take one down and pass it around, 92 bottles of beer on the wall.<br />
<br />
92 bottles of beer on the wall, 92 bottles of beer.<br />
Take one down and pass it around, 91 bottles of beer on the wall.<br />
<br />
91 bottles of beer on the wall, 91 bottles of beer.<br />
Take one down and pass it around, 90 bottles of beer on the wall.<br />
<br />
90 bottles of beer on the wall, 90 bottles of beer.<br />
Take one down and pass it around, 89 bottles of beer on the wall.<br />
<br />
89 bottles of beer on the wall, 89 bottles of beer.<br />
Take one down and pass it around, 88 bottles of beer on the wall.<br />
<br />
88 bottles of beer on the wall, 88 bottles of beer.<br />
Take one down and pass it around, 87 bottles of beer on the wall.<br />
<br />
87 bottles of beer on the wall, 87 bottles of beer.<br />
Take one down and pass it around, 86 bottles of beer on the wall.<br />
<br />
86 bottles of beer on the wall, 86 bottles of beer.<br />
Take one down and pass it around, 85 bottles of beer on the wall.<br />
<br />
85 bottles of beer on the wall, 85 bottles of beer.<br />
Take one down and pass it around, 84 bottles of beer on the wall.<br />
<br />
84 bottles of beer on the wall, 84 bottles of beer.<br />
Take one down and pass it around, 83 bottles of beer on the wall.<br />
<br />
83 bottles of beer on the wall, 83 bottles of beer.<br />
Take one down and pass it around, 82 bottles of beer on the wall.<br />
<br />
82 bottles of beer on the wall, 82 bottles of beer.<br />
Take one down and pass it around, 81 bottles of beer on the wall.<br />
<br />
81 bottles of beer on the wall, 81 bottles of beer.<br />
Take one down and pass it around, 80 bottles of beer on the wall.<br />
<br />
80 bottles of beer on the wall, 80 bottles of beer.<br />
Take one down and pass it around, 79 bottles of beer on the wall.<br />
<br />
79 bottles of beer on the wall, 79 bottles of beer.<br />
Take one down and pass it around, 78 bottles of beer on the wall.<br />
<br />
78 bottles of beer on the wall, 78 bottles of beer.<br />
Take one down and pass it around, 77 bottles of beer on the wall.<br />
<br />
77 bottles of beer on the wall, 77 bottles of beer.<br />
Take one down and pass it around, 76 bottles of beer on the wall.<br />
<br />
76 bottles of beer on the wall, 76 bottles of beer.<br />
Take one down and pass it around, 75 bottles of beer on the wall.<br />
<br />
75 bottles of beer on the wall, 75 bottles of beer.<br />
Take one down and pass it around, 74 bottles of beer on the wall.<br />
<br />
74 bottles of beer on the wall, 74 bottles of beer.<br />
Take one down and pass it around, 73 bottles of beer on the wall.<br />
<br />
73 bottles of beer on the wall, 73 bottles of beer.<br />
Take one down and pass it around, 72 bottles of beer on the wall.<br />
<br />
72 bottles of beer on the wall, 72 bottles of beer.<br />
Take one down and pass it around, 71 bottles of beer on the wall.<br />
<br />
71 bottles of beer on the wall, 71 bottles of beer.<br />
Take one down and pass it around, 70 bottles of beer on the wall.<br />
<br />
70 bottles of beer on the wall, 70 bottles of beer.<br />
Take one down and pass it around, 69 bottles of beer on the wall.<br />
<br />
69 bottles of beer on the wall, 69 bottles of beer.<br />
Take one down and pass it around, 68 bottles of beer on the wall.<br />
<br />
68 bottles of beer on the wall, 68 bottles of beer.<br />
Take one down and pass it around, 67 bottles of beer on the wall.<br />
<br />
67 bottles of beer on the wall, 67 bottles of beer.<br />
Take one down and pass it around, 66 bottles of beer on the wall.<br />
<br />
66 bottles of beer on the wall, 66 bottles of beer.<br />
Take one down and pass it around, 65 bottles of beer on the wall.<br />
<br />
65 bottles of beer on the wall, 65 bottles of beer.<br />
Take one down and pass it around, 64 bottles of beer on the wall.<br />
<br />
64 bottles of beer on the wall, 64 bottles of beer.<br />
Take one down and pass it around, 63 bottles of beer on the wall.<br />
<br />
63 bottles of beer on the wall, 63 bottles of beer.<br />
Take one down and pass it around, 62 bottles of beer on the wall.<br />
<br />
62 bottles of beer on the wall, 62 bottles of beer.<br />
Take one down and pass it around, 61 bottles of beer on the wall.<br />
<br />
61 bottles of beer on the wall, 61 bottles of beer.<br />
Take one down and pass it around, 60 bottles of beer on the wall.<br />
<br />
60 bottles of beer on the wall, 60 bottles of beer.<br />
Take one down and pass it around, 59 bottles of beer on the wall.<br />
<br />
59 bottles of beer on the wall, 59 bottles of beer.<br />
Take one down and pass it around, 58 bottles of beer on the wall.<br />
<br />
58 bottles of beer on the wall, 58 bottles of beer.<br />
Take one down and pass it around, 57 bottles of beer on the wall.<br />
<br />
57 bottles of beer on the wall, 57 bottles of beer.<br />
Take one down and pass it around, 56 bottles of beer on the wall.<br />
<br />
56 bottles of beer on the wall, 56 bottles of beer.<br />
Take one down and pass it around, 55 bottles of beer on the wall.<br />
<br />
55 bottles of beer on the wall, 55 bottles of beer.<br />
Take one down and pass it around, 54 bottles of beer on the wall.<br />
<br />
54 bottles of beer on the wall, 54 bottles of beer.<br />
Take one down and pass it around, 53 bottles of beer on the wall.<br />
<br />
53 bottles of beer on the wall, 53 bottles of beer.<br />
Take one down and pass it around, 52 bottles of beer on the wall.<br />
<br />
52 bottles of beer on the wall, 52 bottles of beer.<br />
Take one down and pass it around, 51 bottles of beer on the wall.<br />
<br />
51 bottles of beer on the wall, 51 bottles of beer.<br />
Take one down and pass it around, 50 bottles of beer on the wall.<br />
<br />
50 bottles of beer on the wall, 50 bottles of beer.<br />
Take one down and pass it around, 49 bottles of beer on the wall.<br />
<br />
49 bottles of beer on the wall, 49 bottles of beer.<br />
Take one down and pass it around, 48 bottles of beer on the wall.<br />
<br />
48 bottles of beer on the wall, 48 bottles of beer.<br />
Take one down and pass it around, 47 bottles of beer on the wall.<br />
<br />
47 bottles of beer on the wall, 47 bottles of beer.<br />
Take one down and pass it around, 46 bottles of beer on the wall.<br />
<br />
46 bottles of beer on the wall, 46 bottles of beer.<br />
Take one down and pass it around, 45 bottles of beer on the wall.<br />
<br />
45 bottles of beer on the wall, 45 bottles of beer.<br />
Take one down and pass it around, 44 bottles of beer on the wall.<br />
<br />
44 bottles of beer on the wall, 44 bottles of beer.<br />
Take one down and pass it around, 43 bottles of beer on the wall.<br />
<br />
43 bottles of beer on the wall, 43 bottles of beer.<br />
Take one down and pass it around, 42 bottles of beer on the wall.<br />
<br />
42 bottles of beer on the wall, 42 bottles of beer.<br />
Take one down and pass it around, 41 bottles of beer on the wall.<br />
<br />
41 bottles of beer on the wall, 41 bottles of beer.<br />
Take one down and pass it around, 40 bottles of beer on the wall.<br />
<br />
40 bottles of beer on the wall, 40 bottles of beer.<br />
Take one down and pass it around, 39 bottles of beer on the wall.<br />
<br />
39 bottles of beer on the wall, 39 bottles of beer.<br />
Take one down and pass it around, 38 bottles of beer on the wall.<br />
<br />
38 bottles of beer on the wall, 38 bottles of beer.<br />
Take one down and pass it around, 37 bottles of beer on the wall.<br />
<br />
37 bottles of beer on the wall, 37 bottles of beer.<br />
Take one down and pass it around, 36 bottles of beer on the wall.<br />
<br />
36 bottles of beer on the wall, 36 bottles of beer.<br />
Take one down and pass it around, 35 bottles of beer on the wall.<br />
<br />
35 bottles of beer on the wall, 35 bottles of beer.<br />
Take one down and pass it around, 34 bottles of beer on the wall.<br />
<br />
34 bottles of beer on the wall, 34 bottles of beer.<br />
Take one down and pass it around, 33 bottles of beer on the wall.<br />
<br />
33 bottles of beer on the wall, 33 bottles of beer.<br />
Take one down and pass it around, 32 bottles of beer on the wall.<br />
<br />
32 bottles of beer on the wall, 32 bottles of beer.<br />
Take one down and pass it around, 31 bottles of beer on the wall.<br />
<br />
31 bottles of beer on the wall, 31 bottles of beer.<br />
Take one down and pass it around, 30 bottles of beer on the wall.<br />
<br />
30 bottles of beer on the wall, 30 bottles of beer.<br />
Take one down and pass it around, 29 bottles of beer on the wall.<br />
<br />
29 bottles of beer on the wall, 29 bottles of beer.<br />
Take one down and pass it around, 28 bottles of beer on the wall.<br />
<br />
28 bottles of beer on the wall, 28 bottles of beer.<br />
Take one down and pass it around, 27 bottles of beer on the wall.<br />
<br />
27 bottles of beer on the wall, 27 bottles of beer.<br />
Take one down and pass it around, 26 bottles of beer on the wall.<br />
<br />
26 bottles of beer on the wall, 26 bottles of beer.<br />
Take one down and pass it around, 25 bottles of beer on the wall.<br />
<br />
25 bottles of beer on the wall, 25 bottles of beer.<br />
Take one down and pass it around, 24 bottles of beer on the wall.<br />
<br />
24 bottles of beer on the wall, 24 bottles of beer.<br />
Take one down and pass it around, 23 bottles of beer on the wall.<br />
<br />
23 bottles of beer on the wall, 23 bottles of beer.<br />
Take one down and pass it around, 22 bottles of beer on the wall.<br />
<br />
22 bottles of beer on the wall, 22 bottles of beer.<br />
Take one down and pass it around, 21 bottles of beer on the wall.<br />
<br />
21 bottles of beer on the wall, 21 bottles of beer.<br />
Take one down and pass it around, 20 bottles of beer on the wall.<br />
<br />
20 bottles of beer on the wall, 20 bottles of beer.<br />
Take one down and pass it around, 19 bottles of beer on the wall.<br />
<br />
19 bottles of beer on the wall, 19 bottles of beer.<br />
Take one down and pass it around, 18 bottles of beer on the wall.<br />
<br />
18 bottles of beer on the wall, 18 bottles of beer.<br />
Take one down and pass it around, 17 bottles of beer on the wall.<br />
<br />
17 bottles of beer on the wall, 17 bottles of beer.<br />
Take one down and pass it around, 16 bottles of beer on the wall.<br />
<br />
16 bottles of beer on the wall, 16 bottles of beer.<br />
Take one down and pass it around, 15 bottles of beer on the wall.<br />
<br />
15 bottles of beer on the wall, 15 bottles of beer.<br />
Take one down and pass it around, 14 bottles of beer on the wall.<br />
<br />
14 bottles of beer on the wall, 14 bottles of beer.<br />
Take one down and pass it around, 13 bottles of beer on the wall.<br />
<br />
13 bottles of beer on the wall, 13 bottles of beer.<br />
Take one down and pass it around, 12 bottles of beer on the wall.<br />
<br />
12 bottles of beer on the wall, 12 bottles of beer.<br />
Take one down and pass it around, 11 bottles of beer on the wall.<br />
<br />
11 bottles of beer on the wall, 11 bottles of beer.<br />
Take one down and pass it around, 10 bottles of beer on the wall.<br />
<br />
10 bottles of beer on the wall, 10 bottles of beer.<br />
Take one down and pass it around, 9 bottles of beer on the wall.<br />
<br />
9 bottles of beer on the wall, 9 bottles of beer.<br />
Take one down and pass it around, 8 bottles of beer on the wall.<br />
<br />
8 bottles of beer on the wall, 8 bottles of beer.<br />
Take one down and pass it around, 7 bottles of beer on the wall.<br />
<br />
7 bottles of beer on the wall, 7 bottles of beer.<br />
Take one down and pass it around, 6 bottles of beer on the wall.<br />
<br />
6 bottles of beer on the wall, 6 bottles of beer.<br />
Take one down and pass it around, 5 bottles of beer on the wall.<br />
<br />
5 bottles of beer on the wall, 5 bottles of beer.<br />
Take one down and pass it around, 4 bottles of beer on the wall.<br />
<br />
4 bottles of beer on the wall, 4 bottles of beer.<br />
Take one down and pass it around, 3 bottles of beer on the wall.<br />
<br />
3 bottles of beer on the wall, 3 bottles of beer.<br />
Take one down and pass it around, 2 bottles of beer on the wall.<br />
<br />
2 bottles of beer on the wall, 2 bottles of beer.<br />
Take one down and pass it around, 1 bottle of beer on the wall.<br />
<br />
1 bottle of beer on the wall, 1 bottle of beer.<br />
Take one down and pass it around, no more bottles of beer on the wall.<br />
<br />
No more bottles of beer on the wall, no more bottles of beer.<br />
Go to the store and buy some more, 99 bottles of beer on the wall.</code><hr />
</div>
</div>
</div>
</div></div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>Mr. White</dc:creator>
			<guid isPermaLink="true">aufgaben-160/brainfuck-interpreter-21371</guid>
		</item>
		<item>
			<title>Anfänger RPN-Rechner</title>
			<link>aufgaben-160/rpn-rechner-19836?goto=newpost</link>
			<pubDate>Wed, 16 Jan 2013 15:22:44 GMT</pubDate>
			<description>Hallo, 
 
mal wieder eine Programmieraufgabe: 
Es geht um den Shunting-yard-Algorithmus (http://de.wikipedia.org/wiki/Shunting-yard-Algorithmus), den...</description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
mal wieder eine Programmieraufgabe:<br />
Es geht um den <a href="http://de.wikipedia.org/wiki/Shunting-yard-Algorithmus" target="_blank" rel="nofollow">Shunting-yard-Algorithmus</a>, den es zu implementieren gilt. Der Algorithmus überführt einen Term aus der Infixnotation in die Reverse Polish Notation (RPN, deutsch: Umgekehrte Polnische Notation). Der überführte Term soll dann <a href="http://de.wikipedia.org/wiki/Umgekehrte_Polnische_Notation#Auswertung" target="_blank" rel="nofollow">berechnet</a> werden.<br />
<br />
Beispiel<br />
Eingabe (Array):  &quot;(&quot;, &quot;22&quot;, &quot;*&quot;, &quot;(&quot;, &quot;13&quot;,  &quot;-&quot;, &quot;4.5&quot;, &quot;)&quot;, &quot;)&quot;, &quot;/&quot;, &quot;2&quot;, &quot;+&quot;, &quot;100&quot;<br />
Ausgabe (RPN): &quot;22&quot;, &quot;13&quot;, &quot;4.5&quot;, &quot;-&quot;, &quot;*&quot;, &quot;2&quot;, &quot;/&quot;, &quot;100&quot;, &quot;+&quot;<br />
Ergebnis: 193.5<br />
<br />
Zusatz<br />
Die Eingabe erfolgt als Zeichenkette (Bsp: &quot;(22 * (13 - 4.5)) / 2 + 100&quot;) und muss durch ein zusätzliches Verfahren erst entsprechend verarbeitet werden. Kurz: eine tokenize-Methode muss programmiert werden. <br />
<br />
<br />
Meine Lösung:<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>Scala</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">object RPN {<br />
&nbsp; &nbsp; &nbsp; &nbsp; private val ops: Map[String, Tuple2[(Double, Double) =&gt; Double, Int]] = <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Map(&quot;+&quot; -&gt; ((a, b) =&gt; a + b, 1), &quot;-&quot; -&gt; ((a, b) =&gt; b - a, 1),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &quot;*&quot; -&gt; ((a, b) =&gt; a * b, 2), &quot;/&quot; -&gt; ((a, b) =&gt; b / a, 2))<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; def fromInfix(s: String): String = {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; val tokens = new scala.collection.mutable.ListBuffer[String]()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; val opStack = new scala.collection.mutable.Stack[String]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (i &lt;- tokenize(s)) i match {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case digit if Character.isDigit(digit(0)) =&gt; tokens += digit<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case op if ops contains op =&gt; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (opStack.length != 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; val cmpVal = if (opStack.head != &quot;(&quot;) ops(opStack.head)._2 else 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (ops(op)._2 &lt; cmpVal &amp;&amp; opStack.length != 0) tokens += opStack.pop()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; opStack push op<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case lparen if lparen == &quot;(&quot; =&gt; opStack push lparen<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case rparen if rparen == &quot;)&quot; =&gt; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (opStack.head != &quot;(&quot;) tokens += opStack.pop()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (opStack.length != 0) opStack.pop()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case dflt =&gt; println(&quot;Unbekanntes Zeichen: &quot; + dflt)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (opStack.length != 0) tokens += opStack.pop()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tokens mkString &quot; &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; def compute(s: String) = {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; val resStack = new scala.collection.mutable.Stack[Double]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tokenize(s).foreach(token =&gt; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (ops contains token) resStack push(ops(token)._1(resStack.pop(), resStack.pop()))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else resStack push token.toDouble<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; resStack.pop()<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private def tokenize(inp: String): Seq[String] = {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; val tokens = new scala.collection.mutable.ListBuffer[String]()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var numbbuffer = &quot;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (i &lt;- inp) i match {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case digit if Character.isDigit(digit) || digit == '.' =&gt; numbbuffer = numbbuffer + digit.toString<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case op if ops.contains(op.toString) || op == '(' || op == ')' || op == ' ' =&gt; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (numbbuffer != &quot;&quot;) { tokens += numbbuffer; numbbuffer = &quot;&quot; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tokens += op.toString<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case dflt =&gt; if (!Character.isWhitespace(dflt)) println(&quot;Unbekanntes Zeichen: &quot; + dflt)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (numbbuffer != &quot;&quot;) (tokens += numbbuffer).filter(_ != &quot; &quot;).toList <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else tokens.filter(_ != &quot; &quot;).toList<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
// Test<br />
println(RPN.compute(RPN.fromInfix(&quot;(22 * (13 - 4.5)) / 2 + 100&quot;))) // 193.5</code><hr />
</div>
</div>
</div>
</div></div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>Mr. White</dc:creator>
			<guid isPermaLink="true">aufgaben-160/rpn-rechner-19836</guid>
		</item>
		<item>
			<title><![CDATA[Anfänger Conway's Game of Life]]></title>
			<link>aufgaben-160/conway-s-game-of-life-16980?goto=newpost</link>
			<pubDate>Wed, 03 Oct 2012 14:26:57 GMT</pubDate>
			<description><![CDATA[Hallo, 
 
damit dieses Subforum auch mal genutzt wird, hier eine Aufgabe: Es soll Conway's Game of Life implementiert werden. 
Dazu ersteinmal...]]></description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
damit dieses Subforum auch mal genutzt wird, hier eine Aufgabe: Es soll Conway's Game of Life implementiert werden.<br />
Dazu ersteinmal grundlegende Informationen aus dem <a href="http://de.wikipedia.org/wiki/Conways_Spiel_des_Lebens" target="_blank" rel="nofollow">Wikipedia-Artikel</a>:<br />
<br />
Das Spiel des Lebens von John Horton Conway ist ein System, das auf einem zweidimensionalen zelluären Automaten basiert.<br />
Das Spielfeld ist in Spalten und Zeilen unterteilt. Jedes Quadrat ist eine Zelle, die zwei Zustände haben kann. Entweder lebt sie, oder sie ist tot. Jede Zelle hat acht Nachbarn (oben, unten, links, rechts und die diagonal angrenzenden Zellen) und diese muss jede Zelle auch kennen, denn die Folgegeneration wird unter Beachtung nachfolgender Regeln erzeugt:<br />
<ul><li style="">Eine tote Zelle mit genau drei lebenden Nachbarn wird in der Folgegeneration leben</li><li style="">Lebende Zellen mit weniger als zwei lebenden Nachbarn sterben in der nächsten Generation</li><li style="">Lebende Zellen mit zwei oder drei lebenden Nachbarn bleiben auch in der Folgegeneration am leben</li><li style="">Lebende Zellen mtt mehr als drei Nachbarn sterben in der Folgegeneration </li></ul><br />
<br />
Aufgaben<br />
<br />
Anfänger: Schreibe eine Klasse für das Spiel des Lebens. Als eine kleine Orientierung sei ein unvollständiges Interface gegeben, das es zu implementieren gilt. Außerdem soll eine beliebige Anfangsgeneration manuell erstellt werden und die ersten 5 Generationen auf der Konsole ausgegeben werden.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">public interface GameOfLifeModel {<br />
&nbsp; &nbsp; // Anzahl Zeilen des Spielfeldes<br />
&nbsp; &nbsp; public static final int ROWS = 60;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; // Anzahl Spalten des Spielfeldes<br />
&nbsp; &nbsp; public static final int COLS = 80;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; // Kantenlänge eines Quadrates (Zelle)<br />
&nbsp; &nbsp; public static final int CELL_SIZE = 10;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; // Berechnet die Folgegeneration und speichert diese.<br />
&nbsp; &nbsp; public void nextGeneration();<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; // Gibt die aktuelle Generation zurück.<br />
&nbsp; &nbsp; // das zweidimensionale boolean-Array ist eine mögliche Form<br />
&nbsp; &nbsp; // der internen Repräsentation.<br />
&nbsp; &nbsp; public boolean[][] getGeneration();<br />
}</code><hr />
</div>Fortgeschritten: <br />
<ul><li style="">Je größer das Spielfeld, desto besser. Es gibt eine Möglichkeit, ein unendliches Spielfeld zu simulieren, in dem man es <a href="http://de.wikipedia.org/wiki/Torus" target="_blank" rel="nofollow">torus-förmig</a> macht.</li><li style="">Erstelle ein GUI, das folgende Funktionalitäten besitzt:<br />
<ul><li style="">Der Benutzer kann die Generation &quot;zeichnen&quot;</li><li style="">Es gibt Buttons für die Berechnung und Anzeige der Folgegeneration und zum Zurücksetzen (alle Zellen sind tot)</li><li style="">Optional: der Benutzer kann eine Animation starten und die Geschwindigkeit einstellen. Die &quot;Animation&quot; soll dann automatisch die Folgegeneration berechnen und anzeigen, bis der Benutzer die Animation stoppt. </li></ul><br />
    </li></ul><br />
<br />
Wer auch die fortgeschrittenen Aufgaben löst, muss natürlich die Lösung der Konsolenausgabe nicht posten.<br />
<br />
Meine Lösung:<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>Java7/JavaFx</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>GameOfLifeMain.java</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">package gameoflife;<br />
<br />
import javafx.application.Application;<br />
import javafx.fxml.FXMLLoader;<br />
import javafx.scene.Parent;<br />
import javafx.scene.Scene;<br />
import javafx.stage.Stage;<br />
<br />
public class GameOfLifeMain extends Application {<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; public void start(Stage stage) throws Exception {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Parent root = FXMLLoader.load(getClass().getResource(&quot;UI_GameOfLife.fxml&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scene scene = new Scene(root);<br />
&nbsp; &nbsp; &nbsp; &nbsp; stage.setTitle(&quot;Conway's Game of Life&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; stage.setScene(scene);<br />
&nbsp; &nbsp; &nbsp; &nbsp; stage.setResizable(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; stage.show();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; launch(args);<br />
&nbsp; &nbsp; }<br />
}</code><hr />
</div>
</div>
</div>
</div><br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>UI_GameOfLife.fxml</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br />
<br />
&lt;?import java.lang.*?&gt;<br />
&lt;?import java.util.*?&gt;<br />
&lt;?import javafx.scene.*?&gt;<br />
&lt;?import javafx.scene.canvas.*?&gt;<br />
&lt;?import javafx.scene.control.*?&gt;<br />
&lt;?import javafx.scene.layout.*?&gt;<br />
&lt;?import javafx.scene.shape.*?&gt;<br />
&lt;?import javafx.scene.text.*?&gt;<br />
<br />
&lt;AnchorPane id=&quot;AnchorPane&quot; minHeight=&quot;634.0&quot; prefHeight=&quot;660.0&quot; prefWidth=&quot;820.0&quot; style=&quot;-fx-background-color: #f3f3f3;&quot; xmlns:fx=&quot;http://javafx.com/fxml&quot; fx:controller=&quot;gameoflife.UI_GameOfLifeController&quot;&gt;<br />
&nbsp; &lt;children&gt;<br />
&nbsp; &nbsp; &lt;HBox id=&quot;HBox&quot; alignment=&quot;CENTER&quot; layoutX=&quot;10.0&quot; layoutY=&quot;10.0&quot; spacing=&quot;20.0&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;children&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;HBox id=&quot;HBox&quot; alignment=&quot;CENTER&quot; spacing=&quot;10.0&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;children&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Button id=&quot;nextGenerationButton&quot; mnemonicParsing=&quot;false&quot; onAction=&quot;#nextGenerationButtonFired&quot; text=&quot;Nächste Generation&quot; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Button mnemonicParsing=&quot;false&quot; onAction=&quot;#resetButtonFired&quot; text=&quot;Reset&quot; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/children&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/HBox&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;HBox id=&quot;HBox&quot; alignment=&quot;CENTER&quot; spacing=&quot;5.0&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;children&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Label text=&quot;Generation:&quot; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Text fx:id=&quot;generationCount&quot; strokeType=&quot;OUTSIDE&quot; strokeWidth=&quot;0.0&quot; text=&quot;0&quot; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/children&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/HBox&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/children&gt;<br />
&nbsp; &nbsp; &lt;/HBox&gt;<br />
&nbsp; &nbsp; &lt;HBox id=&quot;HBox&quot; alignment=&quot;CENTER&quot; layoutX=&quot;438.0&quot; spacing=&quot;15.0&quot; AnchorPane.topAnchor=&quot;10.0&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;children&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;HBox id=&quot;HBox&quot; alignment=&quot;CENTER&quot; spacing=&quot;5.0&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;children&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Button mnemonicParsing=&quot;false&quot; onAction=&quot;#startButtonFired&quot; text=&quot;Start&quot; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Button mnemonicParsing=&quot;false&quot; onAction=&quot;#stopButtonFired&quot; text=&quot;Stop&quot; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/children&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/HBox&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;HBox id=&quot;HBox&quot; alignment=&quot;CENTER&quot; spacing=&quot;5.0&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;children&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Label text=&quot;Speed:&quot; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Slider fx:id=&quot;slider&quot; majorTickUnit=&quot;10.0&quot; min=&quot;1.0&quot; minorTickCount=&quot;1&quot; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/children&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/HBox&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/children&gt;<br />
&nbsp; &nbsp; &lt;/HBox&gt;<br />
&nbsp; &nbsp; &lt;BorderPane id=&quot;generationPane&quot; maxHeight=&quot;-Infinity&quot; maxWidth=&quot;-Infinity&quot; minHeight=&quot;-Infinity&quot; minWidth=&quot;-Infinity&quot; prefHeight=&quot;600.0&quot; prefWidth=&quot;800.0&quot; style=&quot;<br />
&quot; AnchorPane.bottomAnchor=&quot;10.0&quot; AnchorPane.leftAnchor=&quot;10.0&quot; AnchorPane.rightAnchor=&quot;10.0&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;center&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Canvas fx:id=&quot;canvas&quot; height=&quot;600.0&quot; onMouseDragged=&quot;#mouseControl&quot; onMousePressed=&quot;#mouseControl&quot; width=&quot;800.0&quot; /&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/center&gt;<br />
&nbsp; &nbsp; &lt;/BorderPane&gt;<br />
&nbsp; &lt;/children&gt;<br />
&lt;/AnchorPane&gt;</code><hr />
</div>
</div>
</div>
</div><br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>UI_GameOfLifeController.java</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">package gameoflife;<br />
<br />
import java.net.URL;<br />
import java.util.ResourceBundle;<br />
import javafx.animation.Animation;<br />
import javafx.animation.Transition;<br />
import javafx.beans.property.IntegerProperty;<br />
import javafx.beans.property.SimpleIntegerProperty;<br />
import javafx.event.ActionEvent;<br />
import javafx.fxml.FXML;<br />
import javafx.fxml.Initializable;<br />
import javafx.scene.canvas.Canvas;<br />
import javafx.scene.canvas.GraphicsContext;<br />
import javafx.scene.control.Slider;<br />
import javafx.scene.input.MouseEvent;<br />
import javafx.scene.paint.Color;<br />
import javafx.scene.text.Text;<br />
import javafx.util.Duration;<br />
<br />
public class UI_GameOfLifeController implements Initializable {<br />
&nbsp; &nbsp; private GameOfLifeModel model;<br />
&nbsp; &nbsp; private Animation timer;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; @FXML private Canvas canvas;<br />
&nbsp; &nbsp; @FXML private Text generationCount;<br />
&nbsp; &nbsp; @FXML private Slider slider;<br />
<br />
&nbsp; &nbsp; @FXML<br />
&nbsp; &nbsp; private void nextGenerationButtonFired(ActionEvent ae) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; timer.stop();<br />
&nbsp; &nbsp; &nbsp; &nbsp; model.nextGeneration();<br />
&nbsp; &nbsp; &nbsp; &nbsp; drawGeneration();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; @FXML<br />
&nbsp; &nbsp; private void startButtonFired(ActionEvent ae) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; timer.play();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; @FXML<br />
&nbsp; &nbsp; private void stopButtonFired(ActionEvent ae) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; timer.stop();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; @FXML<br />
&nbsp; &nbsp; private void resetButtonFired(ActionEvent ae) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; timer.stop();<br />
&nbsp; &nbsp; &nbsp; &nbsp; model.initDefaultGeneration();<br />
&nbsp; &nbsp; &nbsp; &nbsp; drawGeneration();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; @FXML<br />
&nbsp; &nbsp; private void mouseControl(MouseEvent me) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int x = (int)me.getX();<br />
&nbsp; &nbsp; &nbsp; &nbsp; int y = (int)me.getY();<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (canvas.contains(x, y)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int xc = x / GameOfLifeModel.CELL_SIZE;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int yc = y / GameOfLifeModel.CELL_SIZE;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (me.isSecondaryButtonDown()) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; model.setCell(yc, xc, false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else if (me.isPrimaryButtonDown()) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; model.setCell(yc, xc, true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; drawGeneration();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; private void drawGeneration() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; final GraphicsContext gc = canvas.getGraphicsContext2D();<br />
&nbsp; &nbsp; &nbsp; &nbsp; final int ROWS = GameOfLifeModel.ROWS;<br />
&nbsp; &nbsp; &nbsp; &nbsp; final int COLS = GameOfLifeModel.COLS;<br />
&nbsp; &nbsp; &nbsp; &nbsp; final int CELL_SIZE = GameOfLifeModel.CELL_SIZE;<br />
&nbsp; &nbsp; &nbsp; &nbsp; final boolean[][] generation = model.getGeneration();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gc.setFill(Color.GRAY);<br />
&nbsp; &nbsp; &nbsp; &nbsp; gc.setStroke(Color.BLACK);<br />
&nbsp; &nbsp; &nbsp; &nbsp; gc.fillRect(0, 0, canvas.getWidth(), canvas.getHeight());<br />
&nbsp; &nbsp; &nbsp; &nbsp; gc.setFill(Color.WHITE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int x = 0, y = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int row = 0; row &lt; ROWS; ++row) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int col = 0; col &lt; COLS; ++col) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (generation[row][col]) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gc.fillRect(x, y, CELL_SIZE, CELL_SIZE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x += CELL_SIZE;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y += CELL_SIZE;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; public void initialize(URL url, ResourceBundle rb) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; model = new GameOfLifeModel();<br />
&nbsp; &nbsp; &nbsp; &nbsp; final IntegerProperty speed = new SimpleIntegerProperty(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; slider.valueProperty().bindBidirectional(speed);<br />
&nbsp; &nbsp; &nbsp; &nbsp; generationCount.textProperty().bind(model.generationCountProperty().asString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; timer = new Transition() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setCycleDuration(Duration.millis(500));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setCycleCount(Animation.INDEFINITE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; protected void interpolate(double d) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; model.nextGeneration();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; drawGeneration();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setRate(speed.get());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
&nbsp; &nbsp; &nbsp; &nbsp; drawGeneration();<br />
&nbsp; &nbsp; }<br />
}</code><hr />
</div>
</div>
</div>
</div><br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>GameOfLifeModel.java</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">package gameoflife;<br />
<br />
import java.util.Arrays;<br />
import javafx.beans.property.IntegerProperty;<br />
import javafx.beans.property.SimpleIntegerProperty;<br />
<br />
public class GameOfLifeModel {<br />
&nbsp; &nbsp; public static final int CELL_SIZE = 10;&nbsp; <br />
&nbsp; &nbsp; public static final int ROWS = 60;<br />
&nbsp; &nbsp; public static final int COLS = 80;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; private boolean[][] generation;<br />
&nbsp; &nbsp; private IntegerProperty generationCount;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public GameOfLifeModel() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; generation = new boolean[ROWS][COLS];<br />
&nbsp; &nbsp; &nbsp; &nbsp; generationCount = new SimpleIntegerProperty(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; initDefaultGeneration();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public final void initDefaultGeneration() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int row = 0; row &lt; ROWS; ++row) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int col = 0; col &lt; COLS; ++col) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generation[row][col] = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; generationCount.set(0);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void nextGeneration() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean[][] newGen = new boolean[ROWS][COLS];<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int row = 0; row &lt; ROWS; ++row) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int col = 0; col &lt; COLS; ++col) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int neighbours = countNeighbours(row, col);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!getCell(row, col)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (neighbours == 3) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setCell(newGen, row, col, true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (neighbours &lt; 2) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setCell(newGen, row, col, false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else if (neighbours &lt;= 3) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setCell(newGen, row, col, true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setCell(newGen, row, col, false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!Arrays.equals(newGen, generation)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generation = newGen;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generationCount.set(generationCount.get() + 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public boolean[][] getGeneration() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return generation;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public IntegerProperty generationCountProperty() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return generationCount;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public void setCell(int row, int col, boolean alive) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; setCell(generation, row, col, alive);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; private int countNeighbours(int row, int col) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int counter = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = -1; i &lt;= 1; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int k = -1; k &lt;= 1; k++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (getCell(row + i, col + k)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; counter++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (getCell(row, col)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; counter--;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; return counter;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; private boolean getCell(int row, int col) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; row %= ROWS;<br />
&nbsp; &nbsp; &nbsp; &nbsp; col %= COLS;<br />
&nbsp; &nbsp; &nbsp; &nbsp; row += row &lt; 0 ? ROWS : 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; col += col &lt; 0 ? COLS : 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return generation[row][col];<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; private void setCell(boolean[][] newGen, int row, int col, boolean alive) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; row %= ROWS;<br />
&nbsp; &nbsp; &nbsp; &nbsp; col %= COLS;<br />
&nbsp; &nbsp; &nbsp; &nbsp; row += row &lt; 0 ? ROWS : 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; col += col &lt; 0 ? COLS : 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; newGen[row][col] = alive;<br />
&nbsp; &nbsp; }<br />
}</code><hr />
</div>
</div>
</div>
</div><br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>Screenshots</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<a href="https://u-img.net/img/7457Hu.png" target="_blank">https://u-img.net/img/7457Hu.png</a><br />
<img src="https://u-img.net/img/7457Hu.png" border="0" alt="" /><br />
<a href="https://u-img.net/img/6458Eh.png" target="_blank">https://u-img.net/img/6458Eh.png</a><br />
<img src="https://u-img.net/img/6458Eh.png" border="0" alt="" /><br />
<a href="https://u-img.net/img/5458Nv.png" target="_blank">https://u-img.net/img/5458Nv.png</a><br />
<img src="https://u-img.net/img/5458Nv.png" border="0" alt="" /><br />

</div>
</div>
</div><br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>Download (JAR)</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
Mit der linken Maustaste lebende Zellen zeichnen. Mit der rechten Maustaste töten.<br />
<a href="http://www.file-upload.net/download-6653127/GameOfLife.jar.html" target="_blank" rel="nofollow">GameOfLife.jar</a><br />

</div>
</div>
</div><br />

</div>
</div>
</div></div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>Mr. White</dc:creator>
			<guid isPermaLink="true">aufgaben-160/conway-s-game-of-life-16980</guid>
		</item>
		<item>
			<title>Anfänger Lösen von Knuddels-Matheaufgaben</title>
			<link>aufgaben-160/loesen-knuddels-matheaufgaben-6459?goto=newpost</link>
			<pubDate>Sun, 05 Feb 2012 00:12:28 GMT</pubDate>
			<description><![CDATA[Hey Ho, 
Aufgabe heute ist es, Mathefragen von Knuddels zu lösen. 
Bsp. 
"Nennen Sie die gesuchte Zahl: 5 mal ??? = 20" 
"Nennen Sie die gesuchte...]]></description>
			<content:encoded><![CDATA[<div>Hey Ho,<br />
Aufgabe heute ist es, Mathefragen von Knuddels zu lösen.<br />
Bsp.<br />
&quot;Nennen Sie die gesuchte Zahl: 5 mal ??? = 20&quot;<br />
&quot;Nennen Sie die gesuchte Zahl: 10 durch ??? = 3 Rest 1&quot;<br />
&quot;Nennen Sie die gesuchte Zahl: 5 + 5 = ???&quot;<br />
<br />
Nach diesem Prinzip.<br />
Wie bei dem anderen Thread auch bereits hier eine Lösung von mir.<br />
(Java6 Kompatible!)<br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>Java</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<script type="text/javascript" src="clientscript/syntaxhighlighter/shCore.js"></script>
<script type="text/javascript" src="clientscript/syntaxhighlighter/shBrushJava.js"></script>
<link type="text/css" rel="stylesheet" href="clientscript/syntaxhighlighter/styles/shCoreDefault.css"/>

<pre class="brush: java;">
<br />
/**<br />
     * Löst nummerische Fragen in Knuddels<br />
     * Written by Mentos. If you use it. Say thank you!<br />
     * @param question Die vollständige Frage<br />
     * @return Die (hoffentlich) korrekte Antwort<br />
     */<br />
    private static int solveNumericQuestion(String question) {<br />
<br />
        if (question.startsWith(&quot;Nennen Sie die gesuchte Zahl: &quot;)) {<br />
            question = question.substring(30);<br />
            //System.out.println(question);<br />
        }<br />
        String&#91;&#93; parts = question.split(&quot; &quot;);<br />
        String operator = parts&#91;1&#93;;<br />
<br />
        String firstNumber = parts&#91;0&#93;;<br />
        String secondNumber = parts&#91;2&#93;;<br />
        String thirdNumber = parts&#91;4&#93;;<br />
        int solution = 0;<br />
<br />
        if (operator.equals(&quot;mal&quot;)) {<br />
            if (thirdNumber.equals(&quot;???&quot;)) { // 50 * 50 = ???<br />
                solution = new Integer(firstNumber) * new Integer(secondNumber);<br />
            } else {<br />
                if (firstNumber.equals(&quot;???&quot;)) { // ??? * 20 = 40<br />
                    solution = new Integer(thirdNumber) / new Integer(secondNumber);<br />
                } else if (secondNumber.equals(&quot;???&quot;)) { //20 * ??? = 40<br />
                    solution = new Integer(thirdNumber) / new Integer(firstNumber);<br />
                }<br />
            }<br />
        } else if (operator.equals(&quot;durch&quot;)) {<br />
            if (thirdNumber.equals(&quot;???&quot;)) { // 50 / 25 = ???<br />
                if (question.indexOf(&quot;Rest&quot;) != -1) {<br />
                    firstNumber = String.valueOf(new Integer(firstNumber) - new Integer(parts&#91;6&#93;));<br />
                }<br />
                solution = new Integer(firstNumber) / new Integer(secondNumber);<br />
            } else {<br />
                if (firstNumber.equals(&quot;???&quot;)) { // ??? / 20 = 2<br />
                    solution = new Integer(secondNumber) * new Integer(thirdNumber);<br />
                    if (question.indexOf(&quot;Rest&quot;) != -1) {<br />
                        solution += new Integer(parts&#91;6&#93;);<br />
                    }<br />
                } else if (secondNumber.equals(&quot;???&quot;)) // 19 durch ??? = 1 Rest 7<br />
                {<br />
                    if (question.indexOf(&quot;Rest&quot;) != -1) {<br />
                        firstNumber = String.valueOf(new Integer(firstNumber) - new Integer(parts&#91;6&#93;));<br />
                    }<br />
                    solution = new Integer(firstNumber) / new Integer(thirdNumber);<br />
                }<br />
            }<br />
        } else if (operator.equals(&quot;plus&quot;)) {<br />
            if (thirdNumber.equals(&quot;???&quot;)) { // 50 + 50 = ???<br />
                solution = new Integer(firstNumber) + new Integer(secondNumber);<br />
            } else {<br />
                if (firstNumber.equals(&quot;???&quot;)) { // ??? + 20 = 30<br />
                    solution = new Integer(thirdNumber) - new Integer(secondNumber);<br />
                } else if (secondNumber.equals(&quot;???&quot;)) { // 50 + ??? = 150<br />
                    solution = new Integer(thirdNumber) - new Integer(firstNumber);<br />
                }<br />
            }<br />
        } else if (operator.equals(&quot;minus&quot;)) {<br />
            if (thirdNumber.equals(&quot;???&quot;)) { // 40 - 20 = ???<br />
                solution = new Integer(firstNumber) - new Integer(secondNumber);<br />
            } else {<br />
                if (firstNumber.equals(&quot;???&quot;)) { // ??? - 50 = 10<br />
                    solution = new Integer(thirdNumber) + new Integer(secondNumber);<br />
                } else if (secondNumber.equals(&quot;???&quot;)) {// 50 - ??? = 40<br />
                    solution = new Integer(firstNumber) - new Integer(thirdNumber);<br />
                }<br />
            }<br />
        }<br />
<br />
        return solution;<br />
    }<br />

</pre>
<script type="text/javascript">
SyntaxHighlighter.config.stripBrs = true;
SyntaxHighlighter.all();
</script><br />

</div>
</div>
</div></div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>Mentos</dc:creator>
			<guid isPermaLink="true">aufgaben-160/loesen-knuddels-matheaufgaben-6459</guid>
		</item>
		<item>
			<title>Anfänger Mein Konto.</title>
			<link>aufgaben-160/mein-konto-6352?goto=newpost</link>
			<pubDate>Fri, 03 Feb 2012 21:27:18 GMT</pubDate>
			<description>*Geschichte*: Tja. So schnell kann es gehen. Ich habe wieder mal keine Kohle. Was will man machen? Gottseidank habe ich etwas Geld bei der Bank...</description>
			<content:encoded><![CDATA[<div><b>Geschichte</b>: Tja. So schnell kann es gehen. Ich habe wieder mal keine Kohle. Was will man machen? Gottseidank habe ich etwas Geld bei der Bank angelegt, mit einem Zinssatz von 5% (p.a.) Wie entwickelt sich das Geld?<br />
<br />
<b>Aufgabenstellung</b>: Schreibe ein Programm, welches den Kontostand in Abhängigkeit von dem angelegten Geld, dem Zinssatz und die vergangene Zeit (p.a.) angiebt. <br />
<br />
<b>Advanced</b>: Schreibe eine zusätzliche Funktion, wann das Geld bei dem angegebenen Prozentsatz eine gewünschte Höhe erreicht hat. <br />
<br />
Geplante Zeit:<br />
<br />
Anfänger: Keine Limitierung<br />
<br />
Fortgeschritten: 5 Minuten (+2 Minuten für Advanced)<br />
<br />
Profi: Im Kopf schon beim Aufgabenlesen fertig.<br />
<br />
MfG</div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>Mentos</dc:creator>
			<guid isPermaLink="true">aufgaben-160/mein-konto-6352</guid>
		</item>
		<item>
			<title>Anfänger Kindergeld berechnen</title>
			<link>aufgaben-160/kindergeld-berechnen-6347?goto=newpost</link>
			<pubDate>Fri, 03 Feb 2012 20:45:34 GMT</pubDate>
			<description>HeyHo, 
 
hier eine kleine Aufgabe aus dem Unterricht: 
 
*Aufgabe* 
 
Erstelle ein Konsolen-Programm das nach Eingabe einer Kinderanzahl die Höhe...</description>
			<content:encoded><![CDATA[<div>HeyHo,<br />
<br />
hier eine kleine Aufgabe aus dem Unterricht:<br />
<br />
<font size="3"><b>Aufgabe</b></font><br />
<br />
Erstelle ein Konsolen-Programm das nach Eingabe einer Kinderanzahl die Höhe des Kindergeldes berechnet.<br />
Dabei gilt folgendes:<br />
<ul><li style="">Ein Kind = 20€ Kindergeld</li><li style="">Zwei Kinder = 50€ Kindergeld (20€ für erstes Kind + 30€ für zweites Kind)</li><li style="">Drei Kinder = 90€ Kindergeld (50€ für erstes und zweites Kind + 40€ für drittes Kind)</li><li style="">Mehr als drei Kinder = 90€ Kindergeld + Für jedes weitere Kind 50€ Kindergeld.</li></ul><br />
Das Programm soll nach der Berechnung die Höhe des Kindergeldes ausgeben und zwar wie folgt:<br />
&quot;Bei einer Kinderanzahl von X ist die Höhe des Kindergeldes Y €/Euro&quot;.<br />
<br />
---<br />
<font size="3"><b>Zusatz</b></font><br />
<br />
Zusätzlich kann noch eine Schleife hinzugefügt werden die das Programm sooft wiederholt bis auf die Frage &quot;Wollen Sie aufhören?&quot; mit 'J' oder 'j' geantwortet wird. Am Anfang dieser Schleife soll das Eingabefenster geleert werden.<br />
<br />
<font size="2"><u>Für Fortgeschrittene</u></font><br />
Erstellt das Programm unter 5 Minuten. <br />
(Mit Wiederholungsschleife 6 Minuten)<br />
<br />
<font size="2"><u>Für Profis</u></font><br />
Erstellt das Programm unter 2 Minuten. <br />
(Mit Wiederholungsschleife 3 Minuten)<br />
<br />
---<br />
<font size="3"><b>Programmablaufplan</b>(=PAP)</font><br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<img src="https://u-img.net/img/8724Xu.png" border="0" alt="" />
</div>
</div>
</div></div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>patlux</dc:creator>
			<guid isPermaLink="true">aufgaben-160/kindergeld-berechnen-6347</guid>
		</item>
		<item>
			<title>Fortgeschritten Konvertieren von einem Fifty-String zu einem anderen Format</title>
			<link>aufgaben-160/konvertieren-einem-fifty-string-zu-einem-anderen-format-6320?goto=newpost</link>
			<pubDate>Fri, 03 Feb 2012 15:17:17 GMT</pubDate>
			<description>Hallo, 
als ich mich gerade mit PaT darüber redete, wie wir uns kennenlerneten, kamen wir letzendes zu folgender Fragestellung: 
 
Wie kann man einen...</description>
			<content:encoded><![CDATA[<div>Hallo,<br />
als ich mich gerade mit PaT darüber redete, wie wir uns kennenlerneten, kamen wir letzendes zu folgender Fragestellung:<br />
<br />
Wie kann man einen Knuddels-String (z.B. &quot;2W4 + 3W8 + W10 + W8&quot;) zu folgendem Format umwandeln: &quot;4,4,8,8,8,10,8&quot; (Sprich die Würfel werden &quot;ausgeschrieben&quot; und mit Kommatas getrennt).<br />
<br />
Da es Knuddels ist, und ich dementsprechend in der Beweispflicht bin, dass es nicht zu Eigenprofit ist, hier die C#-Funktion:<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>C#</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP-Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">///&nbsp;&lt;summary&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;///&nbsp;Gibt&nbsp;einen&nbsp;neuen&nbsp;Fifty-String&nbsp;zurück.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;///&nbsp;&lt;/summary&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;///&nbsp;&lt;param&nbsp;name="originalString"&gt;z.B.&nbsp;2W4&nbsp;+&nbsp;2W8&nbsp;+&nbsp;W10&lt;/param&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;///&nbsp;&lt;returns&gt;z.B.&nbsp;4,4,8,8,10&lt;/returns&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">static&nbsp;</span><span style="color: #0000BB">string&nbsp;diceString</span><span style="color: #007700">(</span><span style="color: #0000BB">string&nbsp;originalString</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">StringBuilder&nbsp;finalString&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">StringBuilder</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(</span><span style="color: #0000BB">int&nbsp;i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">originalString</span><span style="color: #007700">.</span><span style="color: #0000BB">Length</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">i</span><span style="color: #007700">++)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">char&nbsp;currentChar&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">originalString</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">i</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">currentChar&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">'W'</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">int&nbsp;times&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Int16</span><span style="color: #007700">.</span><span style="color: #0000BB">Parse</span><span style="color: #007700">(</span><span style="color: #0000BB">currentChar</span><span style="color: #007700">.</span><span style="color: #0000BB">ToString</span><span style="color: #007700">());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">char&nbsp;appendChar&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">originalString</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(</span><span style="color: #0000BB">int&nbsp;i1&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">i1&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">times</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">i1</span><span style="color: #007700">++)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">Append</span><span style="color: #007700">(</span><span style="color: #0000BB">appendChar</span><span style="color: #007700">).</span><span style="color: #0000BB">Append</span><span style="color: #007700">(</span><span style="color: #DD0000">','</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">originalString</span><span style="color: #007700">.</span><span style="color: #0000BB">IndexOf</span><span style="color: #007700">(</span><span style="color: #DD0000">"+&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">i</span><span style="color: #007700">)+</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">Append</span><span style="color: #007700">(</span><span style="color: #0000BB">originalString</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">&#93;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">2&nbsp;</span><span style="color: #007700">&lt;=&nbsp;</span><span style="color: #0000BB">originalString</span><span style="color: #007700">.</span><span style="color: #0000BB">Length</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">Append</span><span style="color: #007700">(</span><span style="color: #0000BB">originalString</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">&#93;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+=&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">Append</span><span style="color: #007700">(</span><span style="color: #DD0000">','</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">ToString</span><span style="color: #007700">().</span><span style="color: #0000BB">Substring</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">Length</span><span style="color: #007700">-</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div>
</div>
</div>
</div><br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>Java</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP-Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">private&nbsp;static&nbsp;</span><span style="color: #0000BB">String&nbsp;diceString</span><span style="color: #007700">(</span><span style="color: #0000BB">String&nbsp;originalString</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">StringBuilder&nbsp;finalString&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">StringBuilder</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(</span><span style="color: #0000BB">int&nbsp;i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">originalString</span><span style="color: #007700">.</span><span style="color: #0000BB">length</span><span style="color: #007700">();&nbsp;</span><span style="color: #0000BB">i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">char&nbsp;currentChar&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">originalString</span><span style="color: #007700">.</span><span style="color: #0000BB">charAt</span><span style="color: #007700">(</span><span style="color: #0000BB">i</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">currentChar&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #DD0000">'W'</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">int&nbsp;times&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Integer</span><span style="color: #007700">.</span><span style="color: #0000BB">parseInt</span><span style="color: #007700">(</span><span style="color: #0000BB">String</span><span style="color: #007700">.</span><span style="color: #0000BB">valueOf</span><span style="color: #007700">(</span><span style="color: #0000BB">currentChar</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">char&nbsp;appendChar&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">originalString</span><span style="color: #007700">.</span><span style="color: #0000BB">charAt</span><span style="color: #007700">(</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(</span><span style="color: #0000BB">int&nbsp;j&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">j&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">times</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">j</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">append</span><span style="color: #007700">(</span><span style="color: #0000BB">appendChar</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">append</span><span style="color: #007700">(</span><span style="color: #DD0000">','</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">originalString</span><span style="color: #007700">.</span><span style="color: #0000BB">indexOf</span><span style="color: #007700">(</span><span style="color: #DD0000">"+&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">i</span><span style="color: #007700">)&nbsp;+&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">append</span><span style="color: #007700">(</span><span style="color: #0000BB">originalString</span><span style="color: #007700">.</span><span style="color: #0000BB">charAt</span><span style="color: #007700">(</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">2&nbsp;</span><span style="color: #007700">&lt;=&nbsp;</span><span style="color: #0000BB">originalString</span><span style="color: #007700">.</span><span style="color: #0000BB">length</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">append</span><span style="color: #007700">(</span><span style="color: #0000BB">originalString</span><span style="color: #007700">.</span><span style="color: #0000BB">charAt</span><span style="color: #007700">(</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">i&nbsp;</span><span style="color: #007700">+=&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">append</span><span style="color: #007700">(</span><span style="color: #DD0000">','</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">toString</span><span style="color: #007700">().</span><span style="color: #0000BB">substring</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">finalString</span><span style="color: #007700">.</span><span style="color: #0000BB">length</span><span style="color: #007700">()&nbsp;-&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div>
</div>
</div>
</div></div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>Mentos</dc:creator>
			<guid isPermaLink="true">aufgaben-160/konvertieren-einem-fifty-string-zu-einem-anderen-format-6320</guid>
		</item>
		<item>
			<title>Anfänger Kürzen von Brüchen</title>
			<link>aufgaben-160/kuerzen-bruechen-6272?goto=newpost</link>
			<pubDate>Thu, 02 Feb 2012 18:34:25 GMT</pubDate>
			<description>Hallo, 
hier die Aufgabe: 
Erstellen Sie eine Methode welche 2 Integer (zaehler und nenner) übergeben bekommt, und diesen Bruch kürzt. 
 
Hilfe:...</description>
			<content:encoded><![CDATA[<div>Hallo,<br />
hier die Aufgabe:<br />
Erstellen Sie eine Methode welche 2 Integer (zaehler und nenner) übergeben bekommt, und diesen Bruch kürzt.<br />
<br />
Hilfe: <a href="http://de.wikipedia.org/wiki/K%C3%BCrzen" target="_blank" rel="nofollow">Kürzen</a><br />
<br />
Die Methode soll den gekürzten Bruch auf der Console ausgeben ODER einfach returnen!<br />
<br />
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b>:<i>JAVA</i> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
<div class="bbcode_container">
	<div class="bbcode_description">PHP-Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">/**<br />&nbsp;*&nbsp;@param&nbsp;zaehler<br />&nbsp;*&nbsp;@param&nbsp;nenner<br />&nbsp;*&nbsp;@author&nbsp;DANP<br />&nbsp;*/<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">public&nbsp;static&nbsp;</span><span style="color: #0000BB">String&nbsp;kuerze</span><span style="color: #007700">(</span><span style="color: #0000BB">int&nbsp;zaehler</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">int&nbsp;nenner</span><span style="color: #007700">){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">int&nbsp;biggernum</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">int&nbsp;kuerzer&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">zaehler&nbsp;</span><span style="color: #007700">&lt;=&nbsp;</span><span style="color: #0000BB">nenner</span><span style="color: #007700">){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">biggernum&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">nenner</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">biggernum&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">zaehler</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(</span><span style="color: #0000BB">int&nbsp;i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;</span><span style="color: #0000BB">i</span><span style="color: #007700">&lt;=</span><span style="color: #0000BB">biggernum</span><span style="color: #007700">;</span><span style="color: #0000BB">i</span><span style="color: #007700">++){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(((</span><span style="color: #0000BB">zaehler</span><span style="color: #007700">%</span><span style="color: #0000BB">i</span><span style="color: #007700">)&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;&amp;&amp;&nbsp;((</span><span style="color: #0000BB">nenner</span><span style="color: #007700">%</span><span style="color: #0000BB">i</span><span style="color: #007700">)&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">kuerzer&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">i</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;(</span><span style="color: #DD0000">"Gekuerzter&nbsp;Bruch:&nbsp;"&nbsp;</span><span style="color: #007700">+&nbsp;(</span><span style="color: #0000BB">zaehler</span><span style="color: #007700">/</span><span style="color: #0000BB">kuerzer</span><span style="color: #007700">)&nbsp;+</span><span style="color: #DD0000">"/"</span><span style="color: #007700">+&nbsp;(</span><span style="color: #0000BB">nenner</span><span style="color: #007700">/</span><span style="color: #0000BB">kuerzer</span><span style="color: #007700">)&nbsp;+</span><span style="color: #DD0000">"\n&nbsp;Gekürzt&nbsp;mit:&nbsp;"&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">kuerzer</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div>
</div>
</div>
</div></div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>DANP</dc:creator>
			<guid isPermaLink="true">aufgaben-160/kuerzen-bruechen-6272</guid>
		</item>
		<item>
			<title>Anfänger 2 Strings mit einander verrechnen</title>
			<link>aufgaben-160/2-strings-mit-einander-verrechnen-6257?goto=newpost</link>
			<pubDate>Thu, 02 Feb 2012 16:18:53 GMT</pubDate>
			<description>*_Aufgabe:_* 
 
Es sind Funktionen zu schreiben, die 2 Ganzzahlen (int, long, char, byte), welche als String übergeben werden, miteinander addieren,...</description>
			<content:encoded><![CDATA[<div><font size="5"><b><u><span style="text-shadow: 0px 0px 10px #8d8d8d">Aufgabe:</span></u></b></font><br />
<br />
Es sind Funktionen zu schreiben, die 2 Ganzzahlen (int, long, char, byte), welche als String übergeben werden, miteinander addieren, subtrahieren, multiplizieren und dividieren.<br />
<br />
Werfe bei möglichen Fehlern Exceptions, oder falls die Programmiersprache es nicht erlaubt, gebe einen Fehlertext aus und beende das Programm sofort.</div>

]]></content:encoded>
			<category domain="aufgaben-160">Aufgaben</category>
			<dc:creator>DeKaDeNz</dc:creator>
			<guid isPermaLink="true">aufgaben-160/2-strings-mit-einander-verrechnen-6257</guid>
		</item>
	</channel>
</rss>
