<?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[If Else]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>Habe wieder mal ein Problem. Das Programm das ich schreiben soll soll die grösste eingegebene Zahl ausgeben. Das hab ich ja hingekriegt. Aber jetzt soll das Programm auch ausgeben die wievielte Eingabe die grösste Zahl war.</p>
<p>Hier erstmal der Grundriss:</p>
<pre><code class="language-cpp">int main()
{
	int zahl1;
	int zahl2;
	int zahl3;
	int zahl4;
	int zahl5;

	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 eine dritte Zahl ein: &quot;;
	cin &gt;&gt;zahl3;

	cout &lt;&lt; &quot;Die vierte Zahl bitte: &quot;;
	cin &gt;&gt;zahl4;

	cout &lt;&lt; &quot;Die fuenfte Zahl bitte: &quot;;
	cin &gt;&gt;zahl5;

	int max= zahl1;

	if (zahl2 &gt; max)
	{
		max = zahl2;
	}

	if (zahl3 &gt; max)
	{
		max = zahl3;
	}

	if (zahl4 &gt; max)
	{
		max = zahl4;
	}

	if (zahl5 &gt; max)
	{
		max = zahl5;
	}

	cout &lt;&lt; &quot;Die groesste Zahl ist: &quot; &lt;&lt; max &lt;&lt;endl;

}
</code></pre>
<p>Danke für eure Hilfe</p>
<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/134455/if-else</link><generator>RSS for Node</generator><lastBuildDate>Fri, 28 Aug 2026 16:26:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/134455.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 26 Jan 2006 10:09:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to If Else on Thu, 26 Jan 2006 10:09:09 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>Habe wieder mal ein Problem. Das Programm das ich schreiben soll soll die grösste eingegebene Zahl ausgeben. Das hab ich ja hingekriegt. Aber jetzt soll das Programm auch ausgeben die wievielte Eingabe die grösste Zahl war.</p>
<p>Hier erstmal der Grundriss:</p>
<pre><code class="language-cpp">int main()
{
	int zahl1;
	int zahl2;
	int zahl3;
	int zahl4;
	int zahl5;

	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 eine dritte Zahl ein: &quot;;
	cin &gt;&gt;zahl3;

	cout &lt;&lt; &quot;Die vierte Zahl bitte: &quot;;
	cin &gt;&gt;zahl4;

	cout &lt;&lt; &quot;Die fuenfte Zahl bitte: &quot;;
	cin &gt;&gt;zahl5;

	int max= zahl1;

	if (zahl2 &gt; max)
	{
		max = zahl2;
	}

	if (zahl3 &gt; max)
	{
		max = zahl3;
	}

	if (zahl4 &gt; max)
	{
		max = zahl4;
	}

	if (zahl5 &gt; max)
	{
		max = zahl5;
	}

	cout &lt;&lt; &quot;Die groesste Zahl ist: &quot; &lt;&lt; max &lt;&lt;endl;

}
</code></pre>
<p>Danke für eure Hilfe</p>
<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/976663</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/976663</guid><dc:creator><![CDATA[Visual Newbie]]></dc:creator><pubDate>Thu, 26 Jan 2006 10:09:09 GMT</pubDate></item><item><title><![CDATA[Reply to If Else on Thu, 26 Jan 2006 10:12:07 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Du könntst zum Beispiel in deinen if-Zweigen eine Variable belegen, die dir sagt, welche Zhal die grösste ist. Wenn also in ersten if-Zweig gesprungen wird, so setzt du die Variablöe auf 2 und so weiter.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/976670</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/976670</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Thu, 26 Jan 2006 10:12:07 GMT</pubDate></item><item><title><![CDATA[Reply to If Else on Thu, 26 Jan 2006 10:14:48 GMT]]></title><description><![CDATA[<p>Beispiele wären echt von Vorteil, weil so gut kann ich Programmieren nicht...</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/976677</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/976677</guid><dc:creator><![CDATA[Visual Newbie]]></dc:creator><pubDate>Thu, 26 Jan 2006 10:14:48 GMT</pubDate></item><item><title><![CDATA[Reply to If Else on Thu, 26 Jan 2006 10:26:10 GMT]]></title><description><![CDATA[<p>Hallo</p>
<pre><code class="language-cpp">int iInputZahl1, iInputZahl2;
int iWelcheZahl = 1;
cout&lt;&lt;&quot;Bitte geben Sie Zhal ein&quot;;
cin&gt;&gt;iInputZahl1;
cout&lt;&lt;&quot;Bitte geben Sie 2. Zahl ein&quot;;
cin&gt;&gt;iInputZhal2;

int max = iInputZhal1;
if(iInputZahl2 &gt; max)
{
    max = iInputZahl2;
    iWelcheZahl = 2;
}

cout&lt;&lt;&quot;Die höchste Zahl lautet &quot;&lt;&lt;max&lt;&lt;&quot; und sie wurde an &quot;&lt;&lt;iWelcheZahl&lt;&lt;&quot;. Stelle eingegeben&quot;&lt;&lt;
</code></pre>
<p>Ich hoffe, dass das klappt, weil ich es nicht getestet habe.<br />
chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/976686</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/976686</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Thu, 26 Jan 2006 10:26:10 GMT</pubDate></item><item><title><![CDATA[Reply to If Else on Thu, 26 Jan 2006 10:26:46 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int max = zahl1;
int zahl = 1;

if (zahl2 &gt; max)
{
    max = zahl2;
    zahl = 2;
}

/* .... */

cout &lt;&lt; &quot;Die groesste Zahl ist die &quot; &lt;&lt; zahl &lt;&lt; &quot;te mit dem Wert: &quot; &lt;&lt; max &lt;&lt; endl;
</code></pre>
<p>Aber bitte noch selbst zuende denken und verstehen <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/976687</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/976687</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 26 Jan 2006 10:26:46 GMT</pubDate></item><item><title><![CDATA[Reply to If Else on Thu, 26 Jan 2006 10:31:13 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int main()
{
    int zahl1; 
    int zahl2; 
    int zahl3; 
    int zahl4; 
    int zahl5; 

    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 eine dritte Zahl ein: &quot;; 
    cin &gt;&gt;zahl3; 

    cout &lt;&lt; &quot;Die vierte Zahl bitte: &quot;; 
    cin &gt;&gt;zahl4; 

    cout &lt;&lt; &quot;Die fuenfte Zahl bitte: &quot;; 
    cin &gt;&gt;zahl5;

	typedef map&lt;int, int&gt; Zahlen;
	Zahlen zahlen;
	zahlen.insert(Zahlen::value_type(zahl1, 1));
	zahlen.insert(Zahlen::value_type(zahl2, 2));
	zahlen.insert(Zahlen::value_type(zahl3, 3));
	zahlen.insert(Zahlen::value_type(zahl4, 4));
	zahlen.insert(Zahlen::value_type(zahl5, 5));

	Zahlen::reverse_iterator it = zahlen.rbegin();
	cout &lt;&lt; &quot;Die groesste Zahl: &quot; &lt;&lt; it-&gt;first &lt;&lt; &quot; wurde an &quot; &lt;&lt; it-&gt;second &lt;&lt; &quot;-ter Stelle eingegeben&quot;;

	return 0;
}
</code></pre>
<p><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="😃"
    /> <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/976695</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/976695</guid><dc:creator><![CDATA[Redhead]]></dc:creator><pubDate>Thu, 26 Jan 2006 10:31:13 GMT</pubDate></item><item><title><![CDATA[Reply to If Else on Thu, 26 Jan 2006 10:46:28 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">const int MAX = 5;
int zahlen[MAX];
int maxzahl;
int pos;
for(int i=0 ; i&lt;MAX ; i++)
{
  cout &lt;&lt; &quot;Bitte geben sie Zahl Nummer &quot;&lt;&lt; i &lt;&lt; &quot; ein:   &quot;;cin &gt;&gt; zahlen[i];
}
for(int i=1 ; i&lt;MAX-1 ; i++)
{
  maxzahl = zahlen[0];
  if(zahlen[i] &gt; zahlen[i-1]
  {
    maxzahl = zahlen[i];
    pos = i;
  } 
}
cout &lt;&lt; &quot;Die grösste Zahl: &quot; &lt;&lt; maxzahl &lt;&lt; &quot; war an Position &quot; &lt;&lt; pos &lt;&lt; endl;
gecth();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/976725</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/976725</guid><dc:creator><![CDATA[masterfu]]></dc:creator><pubDate>Thu, 26 Jan 2006 10:46:28 GMT</pubDate></item><item><title><![CDATA[Reply to If Else on Thu, 26 Jan 2006 11:04:23 GMT]]></title><description><![CDATA[<p>Also wenn schon effizient, dann richtig, da reicht dann auch eine Schleife <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/976752</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/976752</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 26 Jan 2006 11:04:23 GMT</pubDate></item></channel></rss>