<?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[C++ Anfängerfragen]]></title><description><![CDATA[<p>Hey Leute,<br />
ich habe vor ein par Tagen angefangen C++ zu lernen.<br />
Dazu benutze ich dieses <a href="http://tutorial.schornboeck.net/inhalt.htm" rel="nofollow">http://tutorial.schornboeck.net/inhalt.htm</a> Tutorial. Zurzeit bin ich bei dem Kapitel 3 Operatoren und komme leider nicht so richtig vorran.</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
    using namespace std;

    int main()
    {
        cout&lt;&lt;&quot;Bitte geben Sie 2 Zahlen ein:\n&quot;;
        int a,b;
        cin&gt;&gt;a;
        cin&gt;&gt;b;

        //dividieren:
        {
            int temp=a;
            int erg=0;
            while(temp-b &gt;= 0)
            {
                temp-=b;
                ++erg;
            }
            cout&lt;&lt;b&lt;&lt;&quot; ist in &quot;&lt;&lt;a&lt;&lt;&quot; &quot;&lt;&lt;erg&lt;&lt;&quot; mal enthalten (Rest &quot;&lt;&lt;temp&lt;&lt;&quot;)\n&quot;;
        }

        //multiplizieren
        {
            int erg=0;
            for(int i=0;i&lt;b;++i)
            {
                erg+=a;
            }
            cout&lt;&lt;a&lt;&lt;&quot; mal &quot;&lt;&lt;b&lt;&lt;&quot; ist &quot;&lt;&lt;erg&lt;&lt;&quot;\n&quot;;
        }
    }
</code></pre>
<p>Bei diesem Programm wird auf umständliche Weise multipliziert und dividiert.<br />
Aber ich verstehe nicht ganz wie.</p>
<p>Bei dem multiplizieren wird ja gesagt, dass i 0 ist es kleiner als b ist (also die Schleife aufhört sobald es größer wird) und es immer um eins ansteigt.<br />
Wenn ich dass dan mal selber ausrechne würde es ja so aussehen.</p>
<p>Erg=0 a=7 b=4</p>
<p>0=0+7<br />
1=7+7<br />
2=14+7<br />
3=21+7<br />
4=28+7</p>
<p>Dann ist es vorbei da i nun größer als 4 ist.<br />
Aber wieso ist es 35 anstatt 28? Ich bin mir ziemlich sicher dass man erst bei 1 0+7 macht aber wieso? I ist immer der erste wert richtig?</p>
<p>Beim dividieren wird es dann ganz komisch.</p>
<p>Temp ist ja a und in der Rechnung steht auch b also ist das vom Sinn her erstmal total leicht.</p>
<p>Müsste also sein:<br />
7=7-4<br />
7=3<br />
Rest: 3</p>
<p>danach:<br />
erg=erg+1<br />
und da wir erg im Programm ja festgelegt haben (erg=0) würde es immer 0=0+1 sein also passt es einmal rein hier passt es noch aber bei Beispielen wie<br />
10 und 3 z.B. nichtmehr. Was ist daran falsch? Wie muss man es rechnen?</p>
<p>Dann werden vorher noch Variablentypen aufgelistet.<br />
Aber wie werden diese unterteilt?<br />
Es gibt ja z.B. float, double, long double<br />
Die Gleitkommazahl wird dadurch immer genauer. Aber wie finde ich heraus, wie genau es ist und was ich nehmen muss?</p>
<p>Und hat zum Schluss hat jemand oder kann es jemand vielleicht kurz programmieren einen total einfachen Taschenrechner der entweder alles ausrechnet von 2 Zahlen also bei 7 und 4:</p>
<p>7/4<br />
7*4<br />
7+4<br />
7-4</p>
<p>oder man es auswählen kann. Würde mir sowas gerne mal anschauen.</p>
<p>danke schonmal :xmas1:<br />
darkii-</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/230237/c-anfängerfragen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 01:24:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/230237.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 22 Dec 2008 18:04:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ Anfängerfragen on Mon, 22 Dec 2008 18:04:38 GMT]]></title><description><![CDATA[<p>Hey Leute,<br />
ich habe vor ein par Tagen angefangen C++ zu lernen.<br />
Dazu benutze ich dieses <a href="http://tutorial.schornboeck.net/inhalt.htm" rel="nofollow">http://tutorial.schornboeck.net/inhalt.htm</a> Tutorial. Zurzeit bin ich bei dem Kapitel 3 Operatoren und komme leider nicht so richtig vorran.</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
    using namespace std;

    int main()
    {
        cout&lt;&lt;&quot;Bitte geben Sie 2 Zahlen ein:\n&quot;;
        int a,b;
        cin&gt;&gt;a;
        cin&gt;&gt;b;

        //dividieren:
        {
            int temp=a;
            int erg=0;
            while(temp-b &gt;= 0)
            {
                temp-=b;
                ++erg;
            }
            cout&lt;&lt;b&lt;&lt;&quot; ist in &quot;&lt;&lt;a&lt;&lt;&quot; &quot;&lt;&lt;erg&lt;&lt;&quot; mal enthalten (Rest &quot;&lt;&lt;temp&lt;&lt;&quot;)\n&quot;;
        }

        //multiplizieren
        {
            int erg=0;
            for(int i=0;i&lt;b;++i)
            {
                erg+=a;
            }
            cout&lt;&lt;a&lt;&lt;&quot; mal &quot;&lt;&lt;b&lt;&lt;&quot; ist &quot;&lt;&lt;erg&lt;&lt;&quot;\n&quot;;
        }
    }
</code></pre>
<p>Bei diesem Programm wird auf umständliche Weise multipliziert und dividiert.<br />
Aber ich verstehe nicht ganz wie.</p>
<p>Bei dem multiplizieren wird ja gesagt, dass i 0 ist es kleiner als b ist (also die Schleife aufhört sobald es größer wird) und es immer um eins ansteigt.<br />
Wenn ich dass dan mal selber ausrechne würde es ja so aussehen.</p>
<p>Erg=0 a=7 b=4</p>
<p>0=0+7<br />
1=7+7<br />
2=14+7<br />
3=21+7<br />
4=28+7</p>
<p>Dann ist es vorbei da i nun größer als 4 ist.<br />
Aber wieso ist es 35 anstatt 28? Ich bin mir ziemlich sicher dass man erst bei 1 0+7 macht aber wieso? I ist immer der erste wert richtig?</p>
<p>Beim dividieren wird es dann ganz komisch.</p>
<p>Temp ist ja a und in der Rechnung steht auch b also ist das vom Sinn her erstmal total leicht.</p>
<p>Müsste also sein:<br />
7=7-4<br />
7=3<br />
Rest: 3</p>
<p>danach:<br />
erg=erg+1<br />
und da wir erg im Programm ja festgelegt haben (erg=0) würde es immer 0=0+1 sein also passt es einmal rein hier passt es noch aber bei Beispielen wie<br />
10 und 3 z.B. nichtmehr. Was ist daran falsch? Wie muss man es rechnen?</p>
<p>Dann werden vorher noch Variablentypen aufgelistet.<br />
Aber wie werden diese unterteilt?<br />
Es gibt ja z.B. float, double, long double<br />
Die Gleitkommazahl wird dadurch immer genauer. Aber wie finde ich heraus, wie genau es ist und was ich nehmen muss?</p>
<p>Und hat zum Schluss hat jemand oder kann es jemand vielleicht kurz programmieren einen total einfachen Taschenrechner der entweder alles ausrechnet von 2 Zahlen also bei 7 und 4:</p>
<p>7/4<br />
7*4<br />
7+4<br />
7-4</p>
<p>oder man es auswählen kann. Würde mir sowas gerne mal anschauen.</p>
<p>danke schonmal :xmas1:<br />
darkii-</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1634245</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1634245</guid><dc:creator><![CDATA[darkii-]]></dc:creator><pubDate>Mon, 22 Dec 2008 18:04:38 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Mon, 22 Dec 2008 18:38:27 GMT]]></title><description><![CDATA[<blockquote>
<p>Und hat zum Schluss hat jemand oder kann es jemand vielleicht kurz programmieren einen total einfachen Taschenrechner der entweder alles ausrechnet von 2 Zahlen also bei 7 und 4:</p>
</blockquote>
<p>schau dir das ma an.....</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;conio.h&gt;
using namespace std;
double prozent1 (double w,double p);
double prozent2 (double g,double p);
double prozent3 (double w,double g);
double func (double *zahl1, double *pzahl2);
double potenz(double a,double b);
int main()
{   string exit;
    double zahl1,zahl2;
    do
    {
    cout&lt;&lt;&quot;-------------------\n&quot;;
    cout&lt;&lt;&quot;Mein Taschenrechner\n&quot;;
    cout&lt;&lt;&quot;-------------------\n&quot;;
    cout&lt;&lt;&quot;\nWaehlen Sie aus : \n&quot;;
    cout&lt;&lt;&quot;(1) Addition\n&quot;;
    cout&lt;&lt;&quot;(2) Multiplikation\n&quot;;
    cout&lt;&lt;&quot;(3) Division\n&quot;;
    cout&lt;&lt;&quot;(4) Subtraktion\n&quot;;
    cout&lt;&lt;&quot;(5) Potenzrechnung\n&quot;;
    cout&lt;&lt;&quot;(6) Prozentrechnung\n&quot;;
    cout&lt;&lt;&quot;(7) Exit\n&quot;;
    switch (getch())
       {
       case '1':
            {
            func(&amp;zahl1,&amp;zahl2);
            cout&lt;&lt;zahl1&lt;&lt;&quot; + &quot;&lt;&lt;zahl2&lt;&lt;&quot; = &quot;&lt;&lt;zahl1 + zahl2&lt;&lt;endl;
            break;
            }      
       case '2':
            {
            func(&amp;zahl1,&amp;zahl2);
            cout&lt;&lt;zahl1&lt;&lt;&quot; * &quot;&lt;&lt;zahl2&lt;&lt;&quot; = &quot;&lt;&lt;zahl1 * zahl2&lt;&lt;endl;
            break;
            }      
       case '3':
            {
            func(&amp;zahl1,&amp;zahl2);
            if (zahl1&gt;0 ,zahl2&gt;0)
                {
                cout&lt;&lt;zahl1&lt;&lt;&quot; / &quot;&lt;&lt;zahl2&lt;&lt;&quot; = &quot;&lt;&lt;zahl1 / zahl2&lt;&lt;endl;
                }
            else
                {
                if(zahl1&gt;0,zahl2==0)
                {
                cout&lt;&lt;&quot;Teilen durch 0 unmoeglich!&quot;;
                }
                else
                cout&lt;&lt;zahl1&lt;&lt;&quot; / &quot;&lt;&lt;zahl2&lt;&lt;&quot; =  0&quot;&lt;&lt;endl;
                }
            break;
            }      
       case '4':
            {
            func(&amp;zahl1,&amp;zahl2);
            cout&lt;&lt;zahl1&lt;&lt;&quot; - &quot;&lt;&lt;zahl2&lt;&lt;&quot; = &quot;&lt;&lt;zahl1 - zahl2&lt;&lt;endl;
            break;
            }      
       case '5':
            {
            system(&quot;cls&quot;);
            double a,b;
            cout&lt;&lt;&quot;Bitte geben Sie eine Zahl ein :&quot;;
            cin&gt;&gt;a;
            cout&lt;&lt;&quot;Geben Sie die Potenz an :&quot;;
            cin&gt;&gt;b;
            cout&lt;&lt;&quot;Das Ergebniss betraegt : &quot;&lt;&lt;potenz(a,b)&lt;&lt;endl;
            break;
            }
       case '6':
            {
            system(&quot;cls&quot;);
            cout&lt;&lt;&quot;Was moechten Sie Berechnen?\nWaehlen Sie aus:\n&quot;;
            cout&lt;&lt;&quot;(1) Grundwert [G]\n&quot;;
            cout&lt;&lt;&quot;(2) Prozentwert [W]\n&quot;;
            cout&lt;&lt;&quot;(3) Prozentsatz [p]\n&quot;;
            switch (getch())
                 {
                 case '1':
                         {
                         system(&quot;cls&quot;);
                         double w,p;
                         cout&lt;&lt;&quot;bitte geben Sie den Prozentwert W ein: &quot;;
                         cin&gt;&gt;w;
                         cout&lt;&lt;&quot;bitte geben Sie den Prozentsatz p ein: &quot;;
                         cin&gt;&gt;p;
                         cout&lt;&lt;&quot;G = 100*p/W = &quot;&lt;&lt;prozent1(w,p)&lt;&lt;&quot;\n&quot;;
                         break;
                         }
                 case '2':
                         {
                         system(&quot;cls&quot;);     
                         double p,g;
                         cout&lt;&lt;&quot;bitte geben Sie den Grundwert G ein: &quot;;
                         cin&gt;&gt;g;
                         cout&lt;&lt;&quot;bitte geben Sie den Prozentsatz p ein: &quot;;
                         cin&gt;&gt;p;
                         cout&lt;&lt;&quot;W= G*p/100 = &quot;&lt;&lt;prozent2(p,g)&lt;&lt;&quot;\n&quot;;
                         break;
                         }
                 case '3':
                         {
                         system(&quot;cls&quot;);
                         double w,g;
                         cout&lt;&lt;&quot;bitte geben Sie den Grundwert G ein: &quot;;
                         cin&gt;&gt;g;
                         cout&lt;&lt;&quot;bitte geben Sie den Prozentwert W ein: &quot;;
                         cin&gt;&gt;w;
                         cout&lt;&lt;&quot;p= 100*W/G = &quot;&lt;&lt;prozent3(w,g)&lt;&lt;&quot; %\n&quot;;
                         break;
                         }
                  }

            break;
            }
       case '7':
            return 0; 
       default:
               cout&lt;&lt;&quot;Falsche Eingabe!\n&quot;;     
       }
    system(&quot;pause&quot;);
    system(&quot;cls&quot;);
    cout&lt;&lt;&quot;Moechten Sie das Programm beenden j/n ? :&quot;;
    cin&gt;&gt;exit;
    system(&quot;cls&quot;);
    }
  while (exit==&quot;n&quot;);     
}

double potenz (double a,double b)
{
if (b==0)
    return 1;
else
    return a * potenz(a,b-1);
}

double func (double *pzahl1,double *pzahl2)
{
 system(&quot;cls&quot;);
 cout&lt;&lt;&quot;Bitte Geben Sie die erste Zahl ein :&quot;;
 cin&gt;&gt;*pzahl1;
 cout&lt;&lt;&quot;Bitte Geben Sie die zweite Zahl ein :&quot;;
 cin&gt;&gt;*pzahl2;
}

double prozent1 (double w,double p)
{
       return 100*p/w;
}

double prozent2 (double g,double p)
{
       return g*p/100;

double prozent3 (double w,double g)
{
       return 100*w/g;
}

 :xmas1:
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1634257</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1634257</guid><dc:creator><![CDATA[chi]]></dc:creator><pubDate>Mon, 22 Dec 2008 18:38:27 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Mon, 22 Dec 2008 19:23:33 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/20792">@chi</a>,<br />
Habe bei deinem Code getch() mit cin ersetzt. Ausserdem haben eine Klammer und ein Return gefehlt.</p>
<pre><code>#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;conio.h&gt;
using namespace std;
double prozent1 (double w,double p);
double prozent2 (double g,double p);
double prozent3 (double w,double g);
double func (double *zahl1, double *pzahl2);
double potenz(double a,double b);
int main()
{   string exit;
    double zahl1,zahl2;
	char eingabe = 0;
    do
    {
    cout&lt;&lt;&quot;-------------------\n&quot;;
    cout&lt;&lt;&quot;Mein Taschenrechner\n&quot;;
    cout&lt;&lt;&quot;-------------------\n&quot;;
    cout&lt;&lt;&quot;\nWaehlen Sie aus : \n&quot;;
    cout&lt;&lt;&quot;(1) Addition\n&quot;;
    cout&lt;&lt;&quot;(2) Multiplikation\n&quot;;
    cout&lt;&lt;&quot;(3) Division\n&quot;;
    cout&lt;&lt;&quot;(4) Subtraktion\n&quot;;
    cout&lt;&lt;&quot;(5) Potenzrechnung\n&quot;;
    cout&lt;&lt;&quot;(6) Prozentrechnung\n&quot;;
    cout&lt;&lt;&quot;(7) Exit\n&quot;;
	cin &gt;&gt; eingabe;
    switch (eingabe)
       {
       case '1':
            {
            func(&amp;zahl1,&amp;zahl2);
            cout&lt;&lt;zahl1&lt;&lt;&quot; + &quot;&lt;&lt;zahl2&lt;&lt;&quot; = &quot;&lt;&lt;zahl1 + zahl2&lt;&lt;endl;
            break;
            }      
       case '2':
            {
            func(&amp;zahl1,&amp;zahl2);
            cout&lt;&lt;zahl1&lt;&lt;&quot; * &quot;&lt;&lt;zahl2&lt;&lt;&quot; = &quot;&lt;&lt;zahl1 * zahl2&lt;&lt;endl;
            break;
            }      
       case '3':
            {
            func(&amp;zahl1,&amp;zahl2);
            if (zahl1&gt;0 ,zahl2&gt;0)
                {
                cout&lt;&lt;zahl1&lt;&lt;&quot; / &quot;&lt;&lt;zahl2&lt;&lt;&quot; = &quot;&lt;&lt;zahl1 / zahl2&lt;&lt;endl;
                }
            else
                {
                if(zahl1&gt;0,zahl2==0)
                {
                cout&lt;&lt;&quot;Teilen durch 0 unmoeglich!&quot;;
                }
                else
                cout&lt;&lt;zahl1&lt;&lt;&quot; / &quot;&lt;&lt;zahl2&lt;&lt;&quot; =  0&quot;&lt;&lt;endl;
                }
            break;
            }      
       case '4':
            {
            func(&amp;zahl1,&amp;zahl2);
            cout&lt;&lt;zahl1&lt;&lt;&quot; - &quot;&lt;&lt;zahl2&lt;&lt;&quot; = &quot;&lt;&lt;zahl1 - zahl2&lt;&lt;endl;
            break;
            }      
       case '5':
            {
            system(&quot;cls&quot;);
            double a,b;
            cout&lt;&lt;&quot;Bitte geben Sie eine Zahl ein :&quot;;
            cin&gt;&gt;a;
            cout&lt;&lt;&quot;Geben Sie die Potenz an :&quot;;
            cin&gt;&gt;b;
            cout&lt;&lt;&quot;Das Ergebniss betraegt : &quot;&lt;&lt;potenz(a,b)&lt;&lt;endl;
            break;
            }
       case '6':
            {
            system(&quot;cls&quot;);
            cout&lt;&lt;&quot;Was moechten Sie Berechnen?\nWaehlen Sie aus:\n&quot;;
            cout&lt;&lt;&quot;(1) Grundwert [G]\n&quot;;
            cout&lt;&lt;&quot;(2) Prozentwert [W]\n&quot;;
            cout&lt;&lt;&quot;(3) Prozentsatz [p]\n&quot;;
			cin &gt;&gt; eingabe;
            switch (eingabe)
                 {
                 case '1':
                         {
                         system(&quot;cls&quot;);
                         double w,p;
                         cout&lt;&lt;&quot;bitte geben Sie den Prozentwert W ein: &quot;;
                         cin&gt;&gt;w;
                         cout&lt;&lt;&quot;bitte geben Sie den Prozentsatz p ein: &quot;;
                         cin&gt;&gt;p;
                         cout&lt;&lt;&quot;G = 100*p/W = &quot;&lt;&lt;prozent1(w,p)&lt;&lt;&quot;\n&quot;;
                         break;
                         }
                 case '2':
                         {
                         system(&quot;cls&quot;);    
                         double p,g;
                         cout&lt;&lt;&quot;bitte geben Sie den Grundwert G ein: &quot;;
                         cin&gt;&gt;g;
                         cout&lt;&lt;&quot;bitte geben Sie den Prozentsatz p ein: &quot;;
                         cin&gt;&gt;p;
                         cout&lt;&lt;&quot;W= G*p/100 = &quot;&lt;&lt;prozent2(p,g)&lt;&lt;&quot;\n&quot;;
                         break;
                         }
                 case '3':
                         {
                         system(&quot;cls&quot;);
                         double w,g;
                         cout&lt;&lt;&quot;bitte geben Sie den Grundwert G ein: &quot;;
                         cin&gt;&gt;g;
                         cout&lt;&lt;&quot;bitte geben Sie den Prozentwert W ein: &quot;;
                         cin&gt;&gt;w;
                         cout&lt;&lt;&quot;p= 100*W/G = &quot;&lt;&lt;prozent3(w,g)&lt;&lt;&quot; %\n&quot;;
                         break;
                         }
                  }

            break;
            }
       case '7':
            return 0;
       default:
               cout&lt;&lt;&quot;Falsche Eingabe!\n&quot;;    
       }
    system(&quot;pause&quot;);
    system(&quot;cls&quot;);
    cout&lt;&lt;&quot;Moechten Sie das Programm beenden j/n ? :&quot;;
    cin&gt;&gt;exit;
    system(&quot;cls&quot;);
    }
  while (exit==&quot;n&quot;);    
}

double potenz (double a,double b)
{
if (b==0)
    return 1;
else
    return a * potenz(a,b-1);
}

double func (double *pzahl1,double *pzahl2)
{
 system(&quot;cls&quot;);
 cout&lt;&lt;&quot;Bitte Geben Sie die erste Zahl ein :&quot;;
 cin&gt;&gt;*pzahl1;
 cout&lt;&lt;&quot;Bitte Geben Sie die zweite Zahl ein :&quot;;
 cin&gt;&gt;*pzahl2;
 return 0;
}

double prozent1 (double w,double p)
{
       return 100*p/w;
}

double prozent2 (double g,double p)
{
       return g*p/100;
}

double prozent3 (double w,double g)
{
       return 100*w/g;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1634290</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1634290</guid><dc:creator><![CDATA[labviewer]]></dc:creator><pubDate>Mon, 22 Dec 2008 19:23:33 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Mon, 22 Dec 2008 19:29:36 GMT]]></title><description><![CDATA[<p>danke labviewer,<br />
war ich wieder unachtsam........ <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
<p>:xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1634292</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1634292</guid><dc:creator><![CDATA[chi]]></dc:creator><pubDate>Mon, 22 Dec 2008 19:29:36 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 28 Dec 2008 20:00:53 GMT]]></title><description><![CDATA[<p>bump</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1636610</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1636610</guid><dc:creator><![CDATA[darkii-]]></dc:creator><pubDate>Sun, 28 Dec 2008 20:00:53 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Mon, 29 Dec 2008 12:09:43 GMT]]></title><description><![CDATA[<p>Tutorial ordentlich lesen.<br />
Siehe Kommentare.<br />
Wenn man das probiert sieht man aber doch ob das Programm funktioniert oder nicht?<br />
Gibt es eigentlich noch die berühmten Leerzeichen? Furchtbar.</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
    using namespace std;

    int main()
    {
        cout&lt;&lt;&quot;Bitte geben Sie 2 Zahlen ein:\n&quot;;
        int a,b;
        cin&gt;&gt;a; //* sei 7
        cin&gt;&gt;b; //* sei 4

        //dividieren:
        {
            int temp=a; //* Hilfsvariable
            int erg=0; //* Ergebniszähler deklarieren und initialisieren
            while(temp-b &gt;= 0) //* Schleife. Prüfung ob a - b größer/gleich 0
            {
                temp-=b; //* temp = temp - b =&gt; 7 - 4 ist 3 (temp) 
                ++erg; //* Ergebniszähler erhöhen um eins
                //* Zurück zur Schleife. a - b ist kleiner 0, also
                //* Abbruch Schleife
            }
            cout&lt;&lt;b&lt;&lt;&quot; ist in &quot;&lt;&lt;a&lt;&lt;&quot; &quot;&lt;&lt;erg&lt;&lt;&quot; mal enthalten (Rest &quot;&lt;&lt;temp&lt;&lt;&quot;)\n&quot;; //* Noch irgendwelche Fragen
        }

        //multiplizieren
        {
            int erg=0; //* Ergebniszähler deklarieren und initialisieren (0)
            for(int i=0;i&lt;b;++i) //* Schleifenvariable i deklarieren und initialisieren
            {
                erg+=a; //* erg = erg + a
                //* Wenn i = 4 ist, bricht Schleife ab wegen Prüfung i &lt; b (4)
                //* Und bei i = 3 =&gt; 21 + 7 = 28 
            }
            cout&lt;&lt;a&lt;&lt;&quot; mal &quot;&lt;&lt;b&lt;&lt;&quot; ist &quot;&lt;&lt;erg&lt;&lt;&quot;\n&quot;; //* 7 * 4 ist und bleibt 28
        }
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1636792</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1636792</guid><dc:creator><![CDATA[salzlake]]></dc:creator><pubDate>Mon, 29 Dec 2008 12:09:43 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Mon, 29 Dec 2008 21:14:13 GMT]]></title><description><![CDATA[<p>Also vom Sinn her habe ich es jetzt sehr gut verstanden,<br />
einziges Problem ist, ich verstehe die Schleife nicht ganz.<br />
Könnte man es vllt so sehen?</p>
<p>erg 0: temp=7-4<br />
erg 1: temp=3-4 (dort würde es kleiner werden also wird abgebrochen)<br />
dieses ++erg sagt an, das immer +1 zum Ergebnis dazukommt wenn man diese Rechnung durchführt oder?</p>
<p>Dann zum multiplizieren:<br />
Ist dort vllt ein kleiner Fehler drinnen?<br />
Verstehe es eigentlich total es wird auch wieder sofort abgebrochen ABER<br />
es wird ja vorgegeben, dass er es abbricht wenn i größer als b ist was dort nicht der fall ist. Sie sind gleich. Also müsste dort nicht &quot;=&gt;&quot; hin?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1637050</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1637050</guid><dc:creator><![CDATA[darkii-]]></dc:creator><pubDate>Mon, 29 Dec 2008 21:14:13 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Mon, 29 Dec 2008 21:55:59 GMT]]></title><description><![CDATA[<p>darkii- schrieb:</p>
<blockquote>
<p>Verstehe es eigentlich total</p>
</blockquote>
<p>Erste Fehlannahme. Du verstehst es (noch) nicht.</p>
<p>darkii- schrieb:</p>
<blockquote>
<p>es wird ja vorgegeben, dass er es abbricht wenn i größer als b ist</p>
</blockquote>
<pre><code class="language-cpp">for(int i=0;i&lt;b;++i)
</code></pre>
<p>Ok, eine kleine Erklärung zum Zeichen &quot;&lt;&quot;. Dieses Zeichen steht für &quot;kleiner als&quot;. Die Abbruchbedingung in der Schleife lautet also:</p>
<p>Solange i kleiner ist als b.</p>
<p>Die Schleife wird also solange durchlaufen wie i kleiner ist als b.</p>
<p>Jetzt die 100-Punkte Frage: Welchen Wert hat i wenn es zum erstenmal _nicht_ mehr kleiner ist als b? richtig, wenn es gleich b. Beispiel:<br />
kleiner?<br />
0 &lt; 4 ja<br />
1 &lt; 4 ja<br />
2 &lt; 4 ja<br />
3 &lt; 4 ja<br />
4 &lt; 4 nein -&gt; Abbruch</p>
<p>Zusatzfrage: wie oft wurde die Schleife in dem Beispiel ausgeführt:</p>
<p>a) 4 mal<br />
b) 5 mal</p>
<p>Natürlich 4 mal (0-3) Weil beim 5ten Vergleich die Abbruchbedingung ja erfüllt wurde... Und die Abbruchbedingung wird vor Ausführung der Schleife getestet, nicht danach (das wäre sonst eine do-while schleife)</p>
<p>und 4 * 7 = 28. Der Code stimmt also.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1637068</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1637068</guid><dc:creator><![CDATA[loks]]></dc:creator><pubDate>Mon, 29 Dec 2008 21:55:59 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 08:19:14 GMT]]></title><description><![CDATA[<p>-verstanden-</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1637076</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1637076</guid><dc:creator><![CDATA[darkii-]]></dc:creator><pubDate>Sun, 15 Feb 2009 08:19:14 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 08:23:29 GMT]]></title><description><![CDATA[<p>Also ich hätte nocheinmal eine Frage:<br />
Ist jetzt bisschen doof aber davor hatte ich garnicht darauf geachtet.<br />
Was macht cin.get() genau?<br />
Ich habe es so verstanden, dass es das gleiche wie cin&lt;&lt; ist nur dass es dieses objekt dann auch gleich ausgibt..richtig?<br />
und<br />
hat jemand nochmal eine andere erklärung/ein Tutorial für Arrays?<br />
Verstehe die irgendwie nicht ganz. Habe das hier gelesen: <a href="http://tutorial.schornboeck.net/arrays.htm" rel="nofollow">http://tutorial.schornboeck.net/arrays.htm</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1664024</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664024</guid><dc:creator><![CDATA[darkii-]]></dc:creator><pubDate>Sun, 15 Feb 2009 08:23:29 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 09:28:17 GMT]]></title><description><![CDATA[<p>darkii- schrieb:</p>
<blockquote>
<p>Was macht cin.get() genau?<br />
Ich habe es so verstanden, dass es das gleiche wie cin&lt;&lt; ist nur dass es dieses objekt dann auch gleich ausgibt..richtig?</p>
</blockquote>
<p>Dafür ist <a href="http://www.cplusplus.com" rel="nofollow">www.cplusplus.com</a> dein Freund.</p>
<p>darkii- schrieb:</p>
<blockquote>
<p>hat jemand nochmal eine andere erklärung/ein Tutorial für Arrays?<br />
Verstehe die irgendwie nicht ganz.</p>
</blockquote>
<p>Was verstehst du an Arrays nicht? Und vielleicht wäre es besser, dir ein Buch zu besorgen, da lernt man meistens mehr als mit Internet-Tutorials.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1664037</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664037</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 15 Feb 2009 09:28:17 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 10:17:18 GMT]]></title><description><![CDATA[<p>bin auch gerade auf der suche nach einem buch</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1664058</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664058</guid><dc:creator><![CDATA[darkii-]]></dc:creator><pubDate>Sun, 15 Feb 2009 10:17:18 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 10:52:38 GMT]]></title><description><![CDATA[<p>darkii- schrieb:</p>
<blockquote>
<p>bin auch gerade auf der suche nach einem buch</p>
</blockquote>
<p>Thinking in C++ 1/2 sind frei verfügbar als E-Book.<br />
Und dann gäbe es noch den C++-Primer, mit dem viele angefangen haben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1664087</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664087</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 15 Feb 2009 10:52:38 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 11:06:52 GMT]]></title><description><![CDATA[<p>Nexus schrieb:</p>
<blockquote>
<p>Was verstehst du an Arrays nicht?</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1664096</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664096</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Sun, 15 Feb 2009 11:06:52 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 11:13:15 GMT]]></title><description><![CDATA[<p>_matze schrieb:</p>
<blockquote>
<p>Nexus schrieb:</p>
<blockquote>
<p>Was verstehst du an Arrays nicht?</p>
</blockquote>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
Was willst du uns damit sagen?</p>
<p>EDIT:<br />
Was ist jetzt eigentlich mit der Diskette? <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="🙂"
    /> - Hat sie geschmeckt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1664099</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664099</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 15 Feb 2009 11:13:15 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 11:17:11 GMT]]></title><description><![CDATA[<p>drakon schrieb:</p>
<blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
Was willst du uns damit sagen?</p>
</blockquote>
<p>Na dass er die Frage beantworten soll, wenn er ein Verständnisproblem hat. Sonst kann ihm schlecht geholfen werden.</p>
<p>drakon schrieb:</p>
<blockquote>
<p>EDIT:<br />
Was ist jetzt eigentlich mit der Diskette? <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="🙂"
    /> - Hat sie geschmeckt?</p>
</blockquote>
<p>Hehe, war nicht nötig. <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="😃"
    /> Er wusste es auch nicht wirklich zu interpretieren...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1664102</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664102</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Sun, 15 Feb 2009 11:17:11 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 14:42:08 GMT]]></title><description><![CDATA[<p>Nexus schrieb:</p>
<blockquote>
<p>Was verstehst du an Arrays nicht?</p>
</blockquote>
<p>Verstehe es allgemein einfach garnicht was es so richtig bedeuten soll mit 10 etc.<br />
Kurz gesagt: Alles <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/1664228</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664228</guid><dc:creator><![CDATA[darkii-]]></dc:creator><pubDate>Sun, 15 Feb 2009 14:42:08 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 14:47:36 GMT]]></title><description><![CDATA[<p>Ein Array ist eigentlich nichts anderes,als eine Sammlung von Objekten. Das heisst, anstatt</p>
<pre><code class="language-cpp">int zahl1;
int zahl2;
int zahl3;
...
</code></pre>
<p>zu schreiben kannst du das hier machen:</p>
<pre><code class="language-cpp">int zahlen[10];
</code></pre>
<p>Das bedeutet, dass zahlen ein Array ist, dass 10 Zahlen halten kann, welche man von 0-9 ansprechen kann.</p>
<pre><code class="language-cpp">int zahlen[10]; //10 Elemente soll das Array enhalten
zahlen[0] = 2; //erste Zahl wird 2
zahlen[1] = 3; //zweite Zahl wird 2
...
zahlen[9] = 99; // 10te Zahl wird 99

zahlen[10] = 2; // nicht erlaubt, da 10 das 11te Element darstellt und somit nicht vorhanden ist
</code></pre>
<p>So einfach ist das. Das schöne daran ist, dass man auch durchiterieren kann, was bei den benannten Objekten nicht möglich ist.</p>
<pre><code class="language-cpp">//gibt alle Zahlen aus
for (int i = 0; i &lt; 10; i++)
   std::cout &lt;&lt; zahlen[i];
</code></pre>
<p>Wenn du das immernoch nicht verstehst, hol dir unbedingt ein bereits erwähntes Buch. Da wird das ganze nochmal genau erklärt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1664233</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664233</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 15 Feb 2009 14:47:36 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 17:10:41 GMT]]></title><description><![CDATA[<p>3D-Spiele mit C++ und Directx in 21 Tagen<br />
Tipps zur Socket-Programmierung unter C++<br />
Vergleich Delphi und Visual C++<br />
C++ Grundlagen - Quellcode Beispiele<br />
C++ in 21 Tagen<br />
C++ mini E-Book<br />
C++ mit dem Borland C++ Builder<br />
C++ Programmieren mit Stil<br />
C++ Referenz<br />
C++ Wochenend Crashkurs<br />
C++-Programmierung - Programmiersprache, Programmiertechnik, Datenorganisation<br />
EDUCATION Jetzt lerne ich Visual C++ 6<br />
Intensivkurs C++<br />
Jesse Liberty - Jetzt lerne ich C++ - Jubiläumsausgabe<br />
Jetzt lerne ich Visual C++ 6 [Markt&amp;Technik, Dirk Louis]<br />
Konzept der C++ Standard Template Library<br />
Markt &amp; Technik - Jetzt lerne ich C++<br />
Programmieren in C - C++<br />
Spieleprogrammierung in C++<br />
Visual C++ 6 in 21 Tagen<br />
Visual C++ for Dummies Quick Reference<br />
Visual C++ Kompendium<br />
Visual <a href="http://C++.NET" rel="nofollow">C++.NET</a> - Das Buch<br />
Visual Studio C++ .NET ebook<br />
Windows-Programmierung mit C++</p>
<p>Kennt ihr vielleicht welche von denen?<br />
Wäre da vllt ein richtig gutes dabei?<br />
Könnte ich leichter bekommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1664308</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664308</guid><dc:creator><![CDATA[darkii-]]></dc:creator><pubDate>Sun, 15 Feb 2009 17:10:41 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 17:23:05 GMT]]></title><description><![CDATA[<p>Im 3. Post auf dieser Seite habe ich 2 genannt. Davon kannst du dir eines (2 Teile) bereits jetzt runterladen. Soll sehr gut für Anfänger sein. (ich vertraue da mal denen, die es hier gelesen habe..)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1664319</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664319</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 15 Feb 2009 17:23:05 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 17:31:24 GMT]]></title><description><![CDATA[<p>Würde zuerst aber lieber ein deutsches buch holen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1664325</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664325</guid><dc:creator><![CDATA[darkii-]]></dc:creator><pubDate>Sun, 15 Feb 2009 17:31:24 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Sun, 15 Feb 2009 17:40:45 GMT]]></title><description><![CDATA[<p>Das hier ist auf Deutsch und zu empfehlen.</p>
<p><a href="http://www.amazon.de/C-Primer-Stanley-B-Lippman/dp/382732274X" rel="nofollow">http://www.amazon.de/C-Primer-Stanley-B-Lippman/dp/382732274X</a></p>
<p>Die anderen kenne ich nicht, aber (leider) gibt es sehr viel Schund auf dem Markt und wenn ich dich wäre, würde ich die 50 Euro in die Hand nehmen. Dann hast du auch was anständiges.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1664333</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1664333</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 15 Feb 2009 17:40:45 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Wed, 11 Mar 2009 19:35:36 GMT]]></title><description><![CDATA[<p>Stanley B. Lippman: C++ Primer, 4th Edition (Addison-Wesley 2005)<br />
Stephen Prata: C++ Primer Plus, 5th Edition (SAMS 2004)</p>
<p>Habe jetzt diese beiden Ausgaben gesehen..<br />
Welche davon ist denn die bessere?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1678310</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1678310</guid><dc:creator><![CDATA[darkii-]]></dc:creator><pubDate>Wed, 11 Mar 2009 19:35:36 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Wed, 11 Mar 2009 20:01:51 GMT]]></title><description><![CDATA[<p>darkii- schrieb:</p>
<blockquote>
<p>Habe jetzt diese beiden Ausgaben gesehen..<br />
Welche davon ist denn die bessere?</p>
</blockquote>
<p>Wenn du ein deutsches Buch verwenden willst, würde ich zum C++ Primer, 4. Auflage. (10. August 2007) [für 29,95] greifen.</p>
<p>Wie die Auflagen zwischen Deutsch und Englisch sich unterscheiden kann ich dir nicht sagen (Es gibt nicht selten eine Differenz in der Auflagennummer zwischen deutsch und englisch) - zudem kann ich auch nicht erkennen ob der &quot;C++ Primer Plus&quot; wirklich auf dem &quot;C++ Primer&quot; basiert, bedingt durch die Autorenangaben wäre ich da skeptisch.</p>
<p>Aber vielleicht gibt es ja einen der beide Ausgaben kennt...</p>
<p>cu André</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1678323</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1678323</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Wed, 11 Mar 2009 20:01:51 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfängerfragen on Thu, 12 Mar 2009 15:55:55 GMT]]></title><description><![CDATA[<p>Der C++ Primer Plus 5 edition hat nichts mit dem Buch von Lippman zu tuen. Ist ein Einsteiger-Buch und faengt von null an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1678783</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1678783</guid><dc:creator><![CDATA[Spongebob010]]></dc:creator><pubDate>Thu, 12 Mar 2009 15:55:55 GMT</pubDate></item></channel></rss>