<?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[Brüche kürzen]]></title><description><![CDATA[<p>Hallo Leute,<br />
ich möchte ein Programm schreiben, dass 2 Brüche miteinander addiert. Den Code dafür habe ich soweit schon selber programmiert. Nun ist das Problem noch mit dem Kürzen. Ich komme einfach nicht drauf wie ich das machen soll. Code funktioniert; Bsp. 1/2 + 1/2 kommt dann 4/4 raus.<br />
Hoffe es kann mir jemand weiterhelfen.</p>
<p>Gruß fastshadowc</p>
<pre><code>int main() 
{   
    int zaehler; // Deklaration Zähler Ergebnisbruch
    int nenner; // Deklaration Nenner Ergebnisbruch
    struct bruch { // Struktur für Brüche
        int zaehler;
        int nenner;
    };
    struct bruch b1;
    struct bruch b2;
    cout &lt;&lt; &quot;Zaehler Bruch 1: &quot;; // Eingabe Zähler von Bruch 1
    cin &gt;&gt; b1.zaehler;
    cout &lt;&lt; endl;
    cout &lt;&lt; &quot;Nenner Bruch 1: &quot;; // Eingabe Nenner von Bruch 1
    cin &gt;&gt; b1.nenner;
    cout &lt;&lt; endl;
    cout &lt;&lt; &quot;Zaehler Bruch 2: &quot;; // Eingabe Zähler von Bruch 2
    cin &gt;&gt; b2.zaehler;
    cout &lt;&lt; endl;
    cout &lt;&lt; &quot;Nenner Bruch 2: &quot;; // Eingabe Nenner von Bruch 2
    cin &gt;&gt; b2.nenner;
    cout &lt;&lt; endl &lt;&lt; endl;
    cout &lt;&lt; &quot;Bruch 1: &quot; &lt;&lt; b1.zaehler &lt;&lt; &quot;/&quot; &lt;&lt; b1.nenner &lt;&lt; endl; // Anzeige Bruch 1
    cout &lt;&lt; &quot;Bruch 2: &quot; &lt;&lt; b2.zaehler &lt;&lt; &quot;/&quot; &lt;&lt; b2.nenner &lt;&lt; endl; // Anzeige Bruch 2

    zaehler = (b1.zaehler*b2.nenner)+(b1.nenner*b2.zaehler); // Berechnung des Ergebnisbruches
    nenner = b1.nenner*b2.nenner;                            // jedoch ungekürzt

    cout &lt;&lt; endl &lt;&lt; endl;

    cout &lt;&lt; &quot;Ergebnisbruch: &quot; &lt;&lt; endl;
    cout &lt;&lt; zaehler &lt;&lt; &quot;/&quot; &lt;&lt; nenner;
    cout &lt;&lt; endl &lt;&lt; endl;

    system(&quot;PAUSE&quot;);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/314421/brüche-kürzen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 01 Aug 2026 04:41:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/314421.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 01 Mar 2013 19:02:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Brüche kürzen on Fri, 01 Mar 2013 19:02:16 GMT]]></title><description><![CDATA[<p>Hallo Leute,<br />
ich möchte ein Programm schreiben, dass 2 Brüche miteinander addiert. Den Code dafür habe ich soweit schon selber programmiert. Nun ist das Problem noch mit dem Kürzen. Ich komme einfach nicht drauf wie ich das machen soll. Code funktioniert; Bsp. 1/2 + 1/2 kommt dann 4/4 raus.<br />
Hoffe es kann mir jemand weiterhelfen.</p>
<p>Gruß fastshadowc</p>
<pre><code>int main() 
{   
    int zaehler; // Deklaration Zähler Ergebnisbruch
    int nenner; // Deklaration Nenner Ergebnisbruch
    struct bruch { // Struktur für Brüche
        int zaehler;
        int nenner;
    };
    struct bruch b1;
    struct bruch b2;
    cout &lt;&lt; &quot;Zaehler Bruch 1: &quot;; // Eingabe Zähler von Bruch 1
    cin &gt;&gt; b1.zaehler;
    cout &lt;&lt; endl;
    cout &lt;&lt; &quot;Nenner Bruch 1: &quot;; // Eingabe Nenner von Bruch 1
    cin &gt;&gt; b1.nenner;
    cout &lt;&lt; endl;
    cout &lt;&lt; &quot;Zaehler Bruch 2: &quot;; // Eingabe Zähler von Bruch 2
    cin &gt;&gt; b2.zaehler;
    cout &lt;&lt; endl;
    cout &lt;&lt; &quot;Nenner Bruch 2: &quot;; // Eingabe Nenner von Bruch 2
    cin &gt;&gt; b2.nenner;
    cout &lt;&lt; endl &lt;&lt; endl;
    cout &lt;&lt; &quot;Bruch 1: &quot; &lt;&lt; b1.zaehler &lt;&lt; &quot;/&quot; &lt;&lt; b1.nenner &lt;&lt; endl; // Anzeige Bruch 1
    cout &lt;&lt; &quot;Bruch 2: &quot; &lt;&lt; b2.zaehler &lt;&lt; &quot;/&quot; &lt;&lt; b2.nenner &lt;&lt; endl; // Anzeige Bruch 2

    zaehler = (b1.zaehler*b2.nenner)+(b1.nenner*b2.zaehler); // Berechnung des Ergebnisbruches
    nenner = b1.nenner*b2.nenner;                            // jedoch ungekürzt

    cout &lt;&lt; endl &lt;&lt; endl;

    cout &lt;&lt; &quot;Ergebnisbruch: &quot; &lt;&lt; endl;
    cout &lt;&lt; zaehler &lt;&lt; &quot;/&quot; &lt;&lt; nenner;
    cout &lt;&lt; endl &lt;&lt; endl;

    system(&quot;PAUSE&quot;);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2303431</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2303431</guid><dc:creator><![CDATA[fastshadowc++]]></dc:creator><pubDate>Fri, 01 Mar 2013 19:02:16 GMT</pubDate></item><item><title><![CDATA[Reply to Brüche kürzen on Fri, 01 Mar 2013 19:09:39 GMT]]></title><description><![CDATA[<pre><code>int ggt=euklid(zaehler,nenner);
zaehler/=ggt;
nenner/=ggt;
</code></pre>
<p>Dazu guuglen nach dem euklidischen Algorithmus, damit kann man prima den größten gemeinsamen Teiler (GGT) zweier Zahlen herausfinden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2303433</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2303433</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Fri, 01 Mar 2013 19:09:39 GMT</pubDate></item><item><title><![CDATA[Reply to Brüche kürzen on Fri, 01 Mar 2013 19:26:05 GMT]]></title><description><![CDATA[<p>Den erweiterten euklidischen Algorithmus würde ich dir aber nicht empfehlen, eher den normalen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2303436</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2303436</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Fri, 01 Mar 2013 19:26:05 GMT</pubDate></item><item><title><![CDATA[Reply to Brüche kürzen on Fri, 01 Mar 2013 21:29:30 GMT]]></title><description><![CDATA[<p>habe es dank dem euklidischen Algorithmus herausbekommen.<br />
Danke für die Antwort.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2303461</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2303461</guid><dc:creator><![CDATA[fastshadowc++]]></dc:creator><pubDate>Fri, 01 Mar 2013 21:29:30 GMT</pubDate></item></channel></rss>