<?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[Grösste Zahl]]></title><description><![CDATA[<p>Hallo Leute!</p>
<p>Wie kann ich dass den schreiben, wenn die Zahleneingabe nicht vorgegeben ist, sondern beliebig oft eine Zahl eingegeben werden kann und er dann von den Zahlen die grösste Aussuchen soll und die wievielte das war??<br />
Habe da keine Idee. Wäre nett wenn ihr eine hättet.</p>
<pre><code class="language-cpp">int main ()

{
	double zahl1;
	double zahl2;
	double zahl3;
	double zahl4;
	double zahl5;
	double max;

	cout &lt;&lt; &quot;Geben Sie eine Zahl ein: &quot;;
	cin &gt;&gt; zahl1;

	cout &lt;&lt; &quot;Geben Sie eine weitere Zahl ein: &quot;;
	cin &gt;&gt; zahl2;

	cout &lt;&lt; &quot;Geben Sie die dritte Zahl ein: &quot;;
	cin &gt;&gt; zahl3;

	cout &lt;&lt; &quot;Geben Sie die vierte Zahl ein: &quot;;
	cin &gt;&gt; zahl4;

	cout &lt;&lt; &quot;Geben Sie die letzte Zahl ein: &quot;;
	cin &gt;&gt; zahl5;

	max = zahl1;
	int zahl =1;

	if (zahl2 &gt; zahl1)
	{
		max = zahl2;
		zahl = 2;
	}
	if (zahl3 &gt; zahl2)
	{
		max = zahl3;
		 zahl = 3;
	}
	if (zahl4 &gt; zahl3)
	{
		max = zahl4;
		 zahl=4;
	}
	if (zahl5 &gt; zahl4)
	{
		max = zahl5;
	zahl=5;
	}

	cout &lt;&lt; &quot;Die groesste Zahl ist: &quot; &lt;&lt;max &lt;&lt; &quot; und Sie ist an Position: &quot; &lt;&lt; zahl &lt;&lt;endl;

	return 0;

}
</code></pre>
<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="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/135521/grösste-zahl</link><generator>RSS for Node</generator><lastBuildDate>Sat, 29 Aug 2026 00:10:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/135521.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 02 Feb 2006 17:34:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Grösste Zahl on Thu, 02 Feb 2006 17:34:26 GMT]]></title><description><![CDATA[<p>Hallo Leute!</p>
<p>Wie kann ich dass den schreiben, wenn die Zahleneingabe nicht vorgegeben ist, sondern beliebig oft eine Zahl eingegeben werden kann und er dann von den Zahlen die grösste Aussuchen soll und die wievielte das war??<br />
Habe da keine Idee. Wäre nett wenn ihr eine hättet.</p>
<pre><code class="language-cpp">int main ()

{
	double zahl1;
	double zahl2;
	double zahl3;
	double zahl4;
	double zahl5;
	double max;

	cout &lt;&lt; &quot;Geben Sie eine Zahl ein: &quot;;
	cin &gt;&gt; zahl1;

	cout &lt;&lt; &quot;Geben Sie eine weitere Zahl ein: &quot;;
	cin &gt;&gt; zahl2;

	cout &lt;&lt; &quot;Geben Sie die dritte Zahl ein: &quot;;
	cin &gt;&gt; zahl3;

	cout &lt;&lt; &quot;Geben Sie die vierte Zahl ein: &quot;;
	cin &gt;&gt; zahl4;

	cout &lt;&lt; &quot;Geben Sie die letzte Zahl ein: &quot;;
	cin &gt;&gt; zahl5;

	max = zahl1;
	int zahl =1;

	if (zahl2 &gt; zahl1)
	{
		max = zahl2;
		zahl = 2;
	}
	if (zahl3 &gt; zahl2)
	{
		max = zahl3;
		 zahl = 3;
	}
	if (zahl4 &gt; zahl3)
	{
		max = zahl4;
		 zahl=4;
	}
	if (zahl5 &gt; zahl4)
	{
		max = zahl5;
	zahl=5;
	}

	cout &lt;&lt; &quot;Die groesste Zahl ist: &quot; &lt;&lt;max &lt;&lt; &quot; und Sie ist an Position: &quot; &lt;&lt; zahl &lt;&lt;endl;

	return 0;

}
</code></pre>
<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="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/984246</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984246</guid><dc:creator><![CDATA[Visual Newbie]]></dc:creator><pubDate>Thu, 02 Feb 2006 17:34:26 GMT</pubDate></item><item><title><![CDATA[Reply to Grösste Zahl on Thu, 02 Feb 2006 17:49:52 GMT]]></title><description><![CDATA[<p>Beispielsweise so mit einer do while schleife:</p>
<pre><code class="language-cpp">using namespace std;
int main()
{

	double neuezahl;
	double max = 0.0;
	int zaehler = 0;
	char c;

	do
	{
	    cout &lt;&lt; &quot;Geben sie eine Zahl ein : &quot;;
	    cin &gt;&gt; neuezahl;
	    if (neuezahl &gt; max)
	    {
	        max = neuezahl;
	        ++zaehler;
	    }
	    cout &lt;&lt; &quot;Noch eine Zahl ? (j/n)&quot;;
	    cin &gt;&gt; c;
	} while (c != 'n');
	cout &lt;&lt; &quot;Die größte Zahl war &quot; &lt;&lt; max &lt;&lt; &quot; ; an Position : &quot; &lt;&lt;
	zaehler &lt;&lt; std::endl;

	return 0;
}
</code></pre>
<p>Tschau</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984258</guid><dc:creator><![CDATA[Haldke]]></dc:creator><pubDate>Thu, 02 Feb 2006 17:49:52 GMT</pubDate></item><item><title><![CDATA[Reply to Grösste Zahl on Thu, 02 Feb 2006 17:50:17 GMT]]></title><description><![CDATA[<p>Du meinst du gibts ne Zahl ein und in der nächsten Zeile kann man dann wieder was eingeben? Das würd ich mit ner Endlosschleife machen:</p>
<pre><code class="language-cpp">while(true)
{
   cin &gt;&gt; Zahl;
     .
     .
     .
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/984259</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984259</guid><dc:creator><![CDATA[Pigeon]]></dc:creator><pubDate>Thu, 02 Feb 2006 17:50:17 GMT</pubDate></item><item><title><![CDATA[Reply to Grösste Zahl on Thu, 02 Feb 2006 19:09:05 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>so könntest du es auch machen:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

using namespace std;

int main(int argc, char **argv) {
  const unsigned int SIZE = 3;
  double x[SIZE];

  unsigned int i=0;
  for (;i&lt;SIZE;++i) {  //Einlesen
    cout&lt;&lt;&quot;Bitte &quot;&lt;&lt;i+1&lt;&lt;&quot;. Zahl eingeben: &quot;;
    cin&gt;&gt;x[i];
  }

  //Maximum bestimmen
  unsigned int max=0;
  for (i=0;i&lt;SIZE;++i)
    if (x[i] &gt; x[max])
      max = i;

  //Ausgabe
  cout&lt;&lt;&quot;Die groesste Zahl aus&quot;;
  for (i=0;i&lt;SIZE;++i)
    cout&lt;&lt;' '&lt;&lt;x[i];
  cout&lt;&lt; war &quot;&lt;&lt;x[max]&lt;&lt;'\n';

  return 0;
}
</code></pre>
<p>MfG</p>
<p>GPC</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984333</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984333</guid><dc:creator><![CDATA[GPC]]></dc:creator><pubDate>Thu, 02 Feb 2006 19:09:05 GMT</pubDate></item></channel></rss>