<?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[Probleme mit If]]></title><description><![CDATA[<p>Das Programm soll die groesste Zahl ausgeben, dass tut es ja auch, aber wie kriege ich das hin, dass das Programm die Position der groessten Zahl angibt??</p>
<p>Schon im voraus danke...</p>
<pre><code class="language-cpp">int main()
{
	double eingabe1;
	double eingabe2;
	double eingabe3;

			cout &lt;&lt; &quot;Machen Sie ihre eingabe: &quot;;
			cin &gt;&gt; eingabe1;

			cout &lt;&lt; &quot;Noch einmal bitte: &quot;;
			cin &gt;&gt; eingabe2;

			cout &lt;&lt; &quot;Ein letzes Mal: &quot;;
			cin &gt;&gt; eingabe3;

			double max ;
			max = eingabe1;

			double pos = 1 ;

			if ( eingabe2 &gt; max)
			{
				max = eingabe2;
				pos = eingabe2;
			}

			if ( eingabe3 &gt; max)
			{
				max = eingabe3;
				pos = eingabe3;
			}

			cout &lt;&lt; &quot;Die groesste Eingabe ist: &quot; &lt;&lt; max &lt;&lt; &quot;an Postion: &quot; &lt;&lt; pos &lt;&lt; endl;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/135553/probleme-mit-if</link><generator>RSS for Node</generator><lastBuildDate>Sat, 29 Aug 2026 00:09:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/135553.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 02 Feb 2006 20:07:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit If on Thu, 02 Feb 2006 20:56:48 GMT]]></title><description><![CDATA[<p>Das Programm soll die groesste Zahl ausgeben, dass tut es ja auch, aber wie kriege ich das hin, dass das Programm die Position der groessten Zahl angibt??</p>
<p>Schon im voraus danke...</p>
<pre><code class="language-cpp">int main()
{
	double eingabe1;
	double eingabe2;
	double eingabe3;

			cout &lt;&lt; &quot;Machen Sie ihre eingabe: &quot;;
			cin &gt;&gt; eingabe1;

			cout &lt;&lt; &quot;Noch einmal bitte: &quot;;
			cin &gt;&gt; eingabe2;

			cout &lt;&lt; &quot;Ein letzes Mal: &quot;;
			cin &gt;&gt; eingabe3;

			double max ;
			max = eingabe1;

			double pos = 1 ;

			if ( eingabe2 &gt; max)
			{
				max = eingabe2;
				pos = eingabe2;
			}

			if ( eingabe3 &gt; max)
			{
				max = eingabe3;
				pos = eingabe3;
			}

			cout &lt;&lt; &quot;Die groesste Eingabe ist: &quot; &lt;&lt; max &lt;&lt; &quot;an Postion: &quot; &lt;&lt; pos &lt;&lt; endl;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/984445</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984445</guid><dc:creator><![CDATA[Visual Newbie]]></dc:creator><pubDate>Thu, 02 Feb 2006 20:56:48 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit If on Thu, 02 Feb 2006 20:11:56 GMT]]></title><description><![CDATA[<p>z.B so</p>
<pre><code class="language-cpp">if ( eingabe2 &gt; max)
            {
                max = eingabe2;
                pos = 2;
            }
</code></pre>
<p>Kurt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984454</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984454</guid><dc:creator><![CDATA[ZuK]]></dc:creator><pubDate>Thu, 02 Feb 2006 20:11:56 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit If on Thu, 02 Feb 2006 20:54:33 GMT]]></title><description><![CDATA[<p>Und wie geb ich das an, wenn der User selber bestimmen kann, ob jetzt die kleinste oder die groesste zuerst angegeben werden kann???</p>
<p>Danke</p>
<p>Das sind die ersten Versuche. Kann ich eine Do- while Schleife zweimal machen???</p>
<pre><code class="language-cpp">int main()
{

	double wert1;
	double wert2;
	double wert3;
	double wert4;

	char eingabe;

	cout &lt;&lt; &quot;Geben Sie eine Zahl/Zeichen ein: &quot;;
	cin &gt;&gt; wert1;

	cout &lt;&lt; &quot;Geben Sie noch eine Zahl/Zeichen ein: &quot;;
	cin &gt;&gt; wert2;

	cout &lt;&lt; &quot;Geben Sie eine weitere Zahl/Zeichen ein: &quot;;
	cin &gt;&gt; wert3;

	cout &lt;&lt; &quot;Ihre Eingabe bitte: &quot;;
	cin &gt;&gt; wert4;

	cout &lt;&lt; &quot;Moechten Sie die Groesste oder die Kleinste Zahl wissen (g/k)?&quot;;
	cin &gt;&gt; eingabe;

	double max;
	max = wert1;
	do 
	{
		if ( wert2 &gt; max)
		{
			max = wert2;
		}

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

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

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

		while (eingabe == 'g');

	}

	int min;
	min = wert1;
	do
	{
		if (wert2 &lt; min)
		{
			min = wert2;
		}

		if (wert3 &lt; min)
		{
			min = wert3;
		}

		if (wert4 &lt; min)
		{
			min = wert4;
		}

		cout &lt;&lt; &quot;Die kleinste Eingabe ist: &quot; &lt;&lt; min &lt;&lt;endl;

	}
	while (eingabe = 'k'); 

	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/984528</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984528</guid><dc:creator><![CDATA[Visual Newbie]]></dc:creator><pubDate>Thu, 02 Feb 2006 20:54:33 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit If on Thu, 02 Feb 2006 21:09:36 GMT]]></title><description><![CDATA[<p>Schleifen kannst du so viele und so oft machen wie du willst.<br />
In deinem Fall wäre aber ein</p>
<pre><code class="language-cpp">if ( eingabe == 'g' ) {
  ...
}
else if if ( eingabe == 'k' ) {
  ...
}
</code></pre>
<p>wesentlich günstiger als eine Schleife.<br />
Kurt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984546</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984546</guid><dc:creator><![CDATA[ZuK]]></dc:creator><pubDate>Thu, 02 Feb 2006 21:09:36 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit If on Thu, 02 Feb 2006 21:19:17 GMT]]></title><description><![CDATA[<p>Ist eigentlich char besser? Weil man ja auch Buchstaben eingeben soll??<br />
Findet ihr bei mir grobe Programmierfehler im allgemeinen??<br />
Was fehlt hier noch???</p>
<p>Vielen Dank</p>
<pre><code class="language-cpp">int main()
{

	char wert1;
	char wert2;
	char wert3;
	char wert4;

	char eingabe;

	cout &lt;&lt; &quot;Geben Sie eine Zahl/Zeichen ein: &quot;;
	cin &gt;&gt; wert1;

	cout &lt;&lt; &quot;Geben Sie noch eine Zahl/Zeichen ein: &quot;;
	cin &gt;&gt; wert2;

	cout &lt;&lt; &quot;Geben Sie eine weitere Zahl/Zeichen ein: &quot;;
	cin &gt;&gt; wert3;

	cout &lt;&lt; &quot;Ihre Eingabe bitte: &quot;;
	cin &gt;&gt; wert4;

	cout &lt;&lt; &quot;Moechten Sie die Groesste oder die Kleinste Zahl wissen (g/k)?&quot;;
	cin &gt;&gt; eingabe;

	char max;
	max = wert1;

	if (eingabe == 'g')
	{
		if ( wert2 &gt; max)
		{
			max = wert2;
		}

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

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

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

	char min;
	min = wert1;

	else if if (eingabe == 'k')
	{
		if ( wert2 &lt; min )
		{
			min = wert2;
		}

		if ( wert3 &lt; min)
		{
			min = wert3;
		}

		if ( wert4 &lt; min)
		{
			min = wert4;
		}

		cout &lt;&lt; &quot;Die kleinste Zahl ist: &quot; &lt;&lt; min &lt;&lt; endl;
	}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/984559</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984559</guid><dc:creator><![CDATA[Visual Newbie]]></dc:creator><pubDate>Thu, 02 Feb 2006 21:19:17 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit If on Thu, 02 Feb 2006 21:28:09 GMT]]></title><description><![CDATA[<p>so kanns nicht gehen.</p>
<pre><code class="language-cpp">char min;
    min = wert1;

    else if if (eingabe == 'k')
</code></pre>
<p>besser so</p>
<pre><code class="language-cpp">else if (eingabe == 'k') {
       char min;
       min = wert1;
       ...
</code></pre>
<p>Kurt</p>
<p>EDIT: Sehe gerade das if if ist auf meinen Mist gewachsen. War ein Typo.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984568</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984568</guid><dc:creator><![CDATA[ZuK]]></dc:creator><pubDate>Thu, 02 Feb 2006 21:28:09 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit If on Thu, 02 Feb 2006 21:31:49 GMT]]></title><description><![CDATA[<p>Jetzt klappts, vielen Dank für deine Hilfe...</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/984572</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984572</guid><dc:creator><![CDATA[Visual Newbie]]></dc:creator><pubDate>Thu, 02 Feb 2006 21:31:49 GMT</pubDate></item></channel></rss>