<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Anfänger Bsp.]]></title><description><![CDATA[<p>Hallo!</p>
<p>Da mir hier schon einmal so gut weitergeholfen wurde, wende ich mich nun wieder an euch. Ich versuche mir anhand eines Buches C++ selbst beizubringen. Ich steh noch ziemlich am Anfang, genauergesagt bei den Funktionen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Ich soll jetzt hier folgendes Bsp lösen und hab irgendwie noch keine Ahnung wie ich das anpacken soll:<br />
<strong>&quot;Schreiben Sie eine Funktion int ggt(int a, int b), die den größten gemeinsamen Teiler der beiden natürlichen Zahlen a und b berechnet. Verwenden Sie dazu keine Schleifen&quot;</strong></p>
<p>also a und b sollen eingelesen werden, ich darf auch keine externen bibliotheken verwenden.</p>
<p>Bitte helft mir das Bsp zu lösen.<br />
danke<br />
MFG <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/197877/anfänger-bsp</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 08:04:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/197877.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 15 Nov 2007 16:43:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Anfänger Bsp. on Thu, 15 Nov 2007 16:43:43 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Da mir hier schon einmal so gut weitergeholfen wurde, wende ich mich nun wieder an euch. Ich versuche mir anhand eines Buches C++ selbst beizubringen. Ich steh noch ziemlich am Anfang, genauergesagt bei den Funktionen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Ich soll jetzt hier folgendes Bsp lösen und hab irgendwie noch keine Ahnung wie ich das anpacken soll:<br />
<strong>&quot;Schreiben Sie eine Funktion int ggt(int a, int b), die den größten gemeinsamen Teiler der beiden natürlichen Zahlen a und b berechnet. Verwenden Sie dazu keine Schleifen&quot;</strong></p>
<p>also a und b sollen eingelesen werden, ich darf auch keine externen bibliotheken verwenden.</p>
<p>Bitte helft mir das Bsp zu lösen.<br />
danke<br />
MFG <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403836</guid><dc:creator><![CDATA[franz_c++]]></dc:creator><pubDate>Thu, 15 Nov 2007 16:43:43 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Thu, 15 Nov 2007 16:47:21 GMT]]></title><description><![CDATA[<p>Wie weit bist du denn selber schon gekommen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403838</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403838</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Thu, 15 Nov 2007 16:47:21 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Thu, 15 Nov 2007 17:54:47 GMT]]></title><description><![CDATA[<p>So langsam koennte man doch ins Forum einbauen, dass automatisch auf jedes Thema, in dessen Titel 'Anfaenger' vorkommt, automatisch mit folgendem Satz geantwortet wird:</p>
<p>Hier wird keiner deine Aufgaben machen, sondern dir nur bei konkreten Problemen helfen, welche du anhand deines Quelltexts schildern kannst.</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p><a href="http://de.wikipedia.org/wiki/Gr%C3%B6%C3%9Fter_gemeinsamer_Teiler" rel="nofollow">http://de.wikipedia.org/wiki/Größter_gemeinsamer_Teiler</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403869</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403869</guid><dc:creator><![CDATA[t3amkill3r]]></dc:creator><pubDate>Thu, 15 Nov 2007 17:54:47 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Thu, 15 Nov 2007 18:56:26 GMT]]></title><description><![CDATA[<p>Der Link oben soll wahrscheinlich <a href="http://de.wikipedia.org/wiki/Gr%C3%B6%C3%9Fter_gemeinsamer_Teiler_und_kleinstes_gemeinsames_Vielfaches" rel="nofollow">http://de.wikipedia.org/wiki/Gr%C3%B6%C3%9Fter_gemeinsamer_Teiler_und_kleinstes_gemeinsames_Vielfaches</a> heissen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403926</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403926</guid><dc:creator><![CDATA[mbu]]></dc:creator><pubDate>Thu, 15 Nov 2007 18:56:26 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Thu, 15 Nov 2007 19:55:49 GMT]]></title><description><![CDATA[<p>Ich habs halt nicht so mit URLs und Forensoftware und so. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403967</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403967</guid><dc:creator><![CDATA[t3amkill3r]]></dc:creator><pubDate>Thu, 15 Nov 2007 19:55:49 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Thu, 15 Nov 2007 21:02:01 GMT]]></title><description><![CDATA[<p>Ich hab dir mal deine Hausaufgaben gemacht:</p>
<pre><code class="language-cpp">int ggt(int a,int b)
{

 int teiler=0;
 if (a &lt; b) teiler = a;

 if (a &gt; b) teiler = b;

if (a == b || a &lt; 1 || b &lt; 1 ) {return -1;} // bei ungültiger Eingabe wird -1 ausgegeben

 for (;(a%teiler!=0)||(b%teiler!=0);teiler--) // wenn der rest von Zahl1 oder Zahl2 / teiler NICHT 0 ist,
// teiler um 1 verkleinern und erneut versuchen
        {
        if (teiler == 1) {return 1;} // wenn teiler 1 -&gt; return 1
        }
 return teiler;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1403997</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403997</guid><dc:creator><![CDATA[mulo]]></dc:creator><pubDate>Thu, 15 Nov 2007 21:02:01 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Thu, 15 Nov 2007 21:45:33 GMT]]></title><description><![CDATA[<p>franz_c++ schrieb:</p>
<blockquote>
<p><strong>&quot;[...]Verwenden Sie dazu keine Schleifen&quot;</strong></p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1404021</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404021</guid><dc:creator><![CDATA[darthdespotism]]></dc:creator><pubDate>Thu, 15 Nov 2007 21:45:33 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Thu, 15 Nov 2007 21:45:38 GMT]]></title><description><![CDATA[<p>Leicht am Ziel vorbeigeschossen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<blockquote>
<p><strong>Verwenden Sie dazu keine Schleifen</strong></p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1404022</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404022</guid><dc:creator><![CDATA[volltreffer]]></dc:creator><pubDate>Thu, 15 Nov 2007 21:45:38 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Thu, 15 Nov 2007 21:59:12 GMT]]></title><description><![CDATA[<p>Nabend,</p>
<p>er soll es rekursiv berechnen. Schau auf die gepostete Wikiseite, du findest<br />
dort uebrigens auch den entsprechenden rekursiven Algorithmus (Euklidischer<br />
Algorithmus).</p>
<p>gruss<br />
v R</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1404027</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404027</guid><dc:creator><![CDATA[virtuell Realisticer]]></dc:creator><pubDate>Thu, 15 Nov 2007 21:59:12 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Thu, 15 Nov 2007 22:02:43 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">unsigned int ggT(unsigned int a, unsigned int b){
    if(b == 0)
        return a;
    else return ggT(b, a % b);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1404028</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404028</guid><dc:creator><![CDATA[spielverderber]]></dc:creator><pubDate>Thu, 15 Nov 2007 22:02:43 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Thu, 15 Nov 2007 22:06:57 GMT]]></title><description><![CDATA[<p>Hmm <a href="http://de.wikipedia.org/wiki/Euklidischer_Algorithmus" rel="nofollow">Euklidischer Algorithmus</a> wäre das was am einfachsten zu implementieren ist.</p>
<pre><code class="language-cpp">unsigned long gcd(unsigned long a, unsigned long b) { return (b == 0 ? a : gcd(b, a % b)); }
</code></pre>
<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1404029</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404029</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Thu, 15 Nov 2007 22:06:57 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Fri, 18 Jan 2008 18:52:50 GMT]]></title><description><![CDATA[<p>t3amkill3r schrieb:</p>
<blockquote>
<p>So langsam koennte man doch ins Forum einbauen, dass automatisch auf jedes Thema, in dessen Titel 'Anfaenger' vorkommt, automatisch mit folgendem Satz geantwortet wird:</p>
<p>Hier wird keiner deine Aufgaben machen, sondern dir nur bei konkreten Problemen helfen, welche du anhand deines Quelltexts schildern kannst.</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p><a href="http://de.wikipedia.org/wiki/Gr%C3%B6%C3%9Fter_gemeinsamer_Teiler" rel="nofollow">http://de.wikipedia.org/wiki/Größter_gemeinsamer_Teiler</a></p>
</blockquote>
<p>sei gusch bub!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1439206</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1439206</guid><dc:creator><![CDATA[Wittgenstein!]]></dc:creator><pubDate>Fri, 18 Jan 2008 18:52:50 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Fri, 18 Jan 2008 21:08:29 GMT]]></title><description><![CDATA[<p>naja, geht aber noch kürzer, außerdem sind bei ggT und kgV auch negative Zahlen zulässig, also wird das &quot;unsigned&quot; nicht wirklich benötigt:</p>
<pre><code class="language-cpp">long ggT(long a, long b) { return (b == 0 ? a : ggT(b, a % b)); }
long _abs(long x) { return (x &lt; 0 ? x * -1 : x); }
long kgV(long a, long b) { return (_abs(a * b) / ggT(a, b)); }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1439249</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1439249</guid><dc:creator><![CDATA[DrakoXP]]></dc:creator><pubDate>Fri, 18 Jan 2008 21:08:29 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Bsp. on Sat, 19 Jan 2008 10:30:24 GMT]]></title><description><![CDATA[<p>Am besten bringst Du mal die typischen mathematischen Grundlagenspielchen hinter Dich, schau mal bei Volkard vorbei. <a href="http://www.volkard.de/vcppkold/inhalt.html" rel="nofollow">http://www.volkard.de/vcppkold/inhalt.html</a><br />
z.B. <a href="http://www.volkard.de/vcppkold/rekursion.html" rel="nofollow">http://www.volkard.de/vcppkold/rekursion.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1439366</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1439366</guid><dc:creator><![CDATA[Erhard Henkes]]></dc:creator><pubDate>Sat, 19 Jan 2008 10:30:24 GMT</pubDate></item></channel></rss>