<?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[Problem mit for-Schleife]]></title><description><![CDATA[<p>Hallo. Ich wollte, dass die for-Schleife von 1 anfängt zu zählen, damit ich die index-Variable &quot;i&quot; für die Ausgabe einer Durchnummerierung nutzen kann. Da aber Array's bei 0 anfangen, weiß ich nicht wie ich das schreiben soll. Meine gewünschte Ausgabe sieht so aus:<br />
1. Note eingeben<br />
2. Note eingeben<br />
3. Note eingeben<br />
(...)<br />
10. Note eingeben</p>
<p>Könnt Ihr mir helfen?</p>
<p>Ps: Ich weiß, dass der Code sehr umständlich ist, aber nach meinem derzeitigen Erkenntnisstand von C++ fiel mir leider keine praktischere Lösung ein. Bin offen für Anmerkungen und Hinweise diesbezüglich. <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>
<pre><code class="language-cpp">#include &lt;iostream&gt; 
using namespace std; 

int main() 
{ 
    int anzahl[10]; 
    double noten;
    double ergebnis;

    cout &lt;&lt; &quot;Notendurchschnitt errechnen:&quot; &lt;&lt; endl; 
    cout &lt;&lt; &quot;Geben Sie 10 Faecher ein!\t&quot;; 
    cout &lt;&lt; endl &lt;&lt; endl;

    for (int i = 0; i &lt; 10; i++)
    {  
      // HIER SOLL ANGEFANGEN WERDEN ZU ZÄHLEN
            cout &lt;&lt; &quot;Note eingeben: &quot;; 
            cin  &gt;&gt; anzahl[i]; 

        }
        cout &lt;&lt; endl;
    for (int i = 0; i &lt; 10; i++)
    {
            cout &lt;&lt; &quot;Ausgabe: &quot;; 
            cout  &lt;&lt; anzahl[i] &lt;&lt; endl; 
        }
        noten = anzahl[0] + anzahl[1] + anzahl[2] + anzahl[3] + anzahl[4] + anzahl[5] + anzahl[6] + anzahl[7] + anzahl[8] + anzahl[9];
        ergebnis = noten / 10;
        cout.precision(2);
        cout &lt;&lt; ergebnis &lt;&lt; endl;
        system (&quot;pause&quot;);
        return 0; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/235498/problem-mit-for-schleife</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 04:21:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/235498.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Mar 2009 00:53:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit for-Schleife on Tue, 03 Mar 2009 01:30:11 GMT]]></title><description><![CDATA[<p>Hallo. Ich wollte, dass die for-Schleife von 1 anfängt zu zählen, damit ich die index-Variable &quot;i&quot; für die Ausgabe einer Durchnummerierung nutzen kann. Da aber Array's bei 0 anfangen, weiß ich nicht wie ich das schreiben soll. Meine gewünschte Ausgabe sieht so aus:<br />
1. Note eingeben<br />
2. Note eingeben<br />
3. Note eingeben<br />
(...)<br />
10. Note eingeben</p>
<p>Könnt Ihr mir helfen?</p>
<p>Ps: Ich weiß, dass der Code sehr umständlich ist, aber nach meinem derzeitigen Erkenntnisstand von C++ fiel mir leider keine praktischere Lösung ein. Bin offen für Anmerkungen und Hinweise diesbezüglich. <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>
<pre><code class="language-cpp">#include &lt;iostream&gt; 
using namespace std; 

int main() 
{ 
    int anzahl[10]; 
    double noten;
    double ergebnis;

    cout &lt;&lt; &quot;Notendurchschnitt errechnen:&quot; &lt;&lt; endl; 
    cout &lt;&lt; &quot;Geben Sie 10 Faecher ein!\t&quot;; 
    cout &lt;&lt; endl &lt;&lt; endl;

    for (int i = 0; i &lt; 10; i++)
    {  
      // HIER SOLL ANGEFANGEN WERDEN ZU ZÄHLEN
            cout &lt;&lt; &quot;Note eingeben: &quot;; 
            cin  &gt;&gt; anzahl[i]; 

        }
        cout &lt;&lt; endl;
    for (int i = 0; i &lt; 10; i++)
    {
            cout &lt;&lt; &quot;Ausgabe: &quot;; 
            cout  &lt;&lt; anzahl[i] &lt;&lt; endl; 
        }
        noten = anzahl[0] + anzahl[1] + anzahl[2] + anzahl[3] + anzahl[4] + anzahl[5] + anzahl[6] + anzahl[7] + anzahl[8] + anzahl[9];
        ergebnis = noten / 10;
        cout.precision(2);
        cout &lt;&lt; ergebnis &lt;&lt; endl;
        system (&quot;pause&quot;);
        return 0; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1673209</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1673209</guid><dc:creator><![CDATA[skullyan]]></dc:creator><pubDate>Tue, 03 Mar 2009 01:30:11 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit for-Schleife on Tue, 03 Mar 2009 01:14:32 GMT]]></title><description><![CDATA[<p>Dann geb doch folgendes aus:</p>
<pre><code class="language-cpp">cout &lt;&lt; &quot;Nummer:&quot; &lt;&lt; i+1;
</code></pre>
<p>Hoffentlich habe ich dein Problem richtig verstanden...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1673213</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1673213</guid><dc:creator><![CDATA[DerFrosch]]></dc:creator><pubDate>Tue, 03 Mar 2009 01:14:32 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit for-Schleife on Tue, 03 Mar 2009 01:34:03 GMT]]></title><description><![CDATA[<p>Jepp, hast Du... Vielen Dank! Kannst Du mir vieleicht auch einen Weg zeigen, wie ich zuerst abfragen kann, wieviele Fächer die Person hat?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt; 
using namespace std; 

int main() 
{ 
    int anzahl[10]; 
    double noten;
    double ergebnis;

    cout &lt;&lt; &quot;Hier koennen Sie Ihre Zeugnisdurchschnittsnote ausrechnen.&quot; &lt;&lt; endl; 
    cout &lt;&lt; &quot;Geben Sie 10 Faecher ein!\t&quot;; 
    cout &lt;&lt; endl &lt;&lt; endl; 

    for (int i = 0; i &lt; 10; i++)
    {  
            cout &lt;&lt; i+1 &lt;&lt; &quot;. &quot;;
            cout &lt;&lt; &quot;Note eingeben: &quot;; 
            cin  &gt;&gt; anzahl[i]; 

        }
        cout &lt;&lt; endl;
    for (int i = 0; i &lt; 10; i++)
    {
            cout &lt;&lt; &quot;Ausgabe: &quot;; 
            cout  &lt;&lt; anzahl[i] &lt;&lt; endl; 
        }
        noten = anzahl[0] + anzahl[1] + anzahl[2] + anzahl[3] + anzahl[4] + anzahl[5] + anzahl[6] + anzahl[7] + anzahl[8] + anzahl[9];
        ergebnis = noten / 10;
        cout.precision(2);
        cout &lt;&lt; &quot;\nDein Notendurchschnitt lautet: &quot; &lt;&lt; ergebnis &lt;&lt; endl;
        system (&quot;pause&quot;);
        return 0; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1673215</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1673215</guid><dc:creator><![CDATA[skullyan]]></dc:creator><pubDate>Tue, 03 Mar 2009 01:34:03 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit for-Schleife on Tue, 03 Mar 2009 03:39:51 GMT]]></title><description><![CDATA[<p>Hab ich jetzt zwar nicht ausprobiert, aber müsste so funktionieren...</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

int main()
{
    int anzahl[30], faecher; //maximal 30 faecher wegen dem Array
    double noten=0.0;
    double ergebnis;

    cout &lt;&lt; &quot;Hier koennen Sie Ihre Zeugnisdurchschnittsnote ausrechnen.&quot; &lt;&lt; endl;   
    do {
        cout &lt;&lt; endl &lt;&lt; &quot;Geben Sie die Anzahl der Fächer ein(max. 30):&quot;;
        cin &gt;&gt; faecher;
        if(faecher&gt;30 || faecher &lt; 1)
                cout &lt;&lt; &quot;Fehler, die Zahl war falsch!!!&quot;;
    }
    while(faecher&gt;30 || faecher &lt; 1);    

    cout &lt;&lt; &quot;Geben Sie &quot; &lt;&lt; faecher &lt;&lt; &quot; Faecher ein!\t&quot;;
    cout &lt;&lt; endl &lt;&lt; endl;

    for (int i = 0; i &lt; faecher; i++)
    {  
            cout &lt;&lt; i+1 &lt;&lt; &quot;. &quot;;
            cout &lt;&lt; &quot;Note eingeben: &quot;;
            cin  &gt;&gt; anzahl[i];

        }
        cout &lt;&lt; endl;
    for (int i = 0; i &lt; faecher; i++)
    {
            cout &lt;&lt; &quot;Ausgabe: &quot;;
            cout  &lt;&lt; anzahl[i] &lt;&lt; endl;
            noten += anzahl[i];
        }

        ergebnis = noten / faecher;
        cout.precision(2);
        cout &lt;&lt; &quot;\nDein Notendurchschnitt lautet: &quot; &lt;&lt; ergebnis &lt;&lt; endl;
        system (&quot;pause&quot;);
        return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1673220</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1673220</guid><dc:creator><![CDATA[DerFrosch]]></dc:creator><pubDate>Tue, 03 Mar 2009 03:39:51 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit for-Schleife on Tue, 03 Mar 2009 08:21:09 GMT]]></title><description><![CDATA[<p>Kleiner Zusatz, wenn du <code>std::vector&lt;int&gt;</code> benutzt, kannst du sogar beliebig viele Fächer für einen Schüler oder was es ist speichern. Eventuell wäre es dann noch interessant für die Benutzer eine eigene Klasse zu gestalten. Aber das kannste später machen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1673257</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1673257</guid><dc:creator><![CDATA[Firefighter]]></dc:creator><pubDate>Tue, 03 Mar 2009 08:21:09 GMT</pubDate></item></channel></rss>