<?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[Herleitung?!]]></title><description><![CDATA[<p>Hi ich habe mal eine Frage. Ich programmiere noch nicht sehr lang und dies ist mein erstes &quot;größeres&quot; Projekt. Ich weiß nicht was da los ist aber ich bekomme sehr viele Fehlermeldungen. Ich kopiere mal die erste rein da es immer die selbe Fehlermeldung ist:</p>
<p>1&gt;c:\users\daniel spiele\documents\visual studio 2010\projects\rechner\rechner\rechner.cpp(47): error C2784: &quot;std::basic_ostream&lt;_Elem,_Traits&gt; &amp;std::operator &lt;&lt;(std::basic_ostream&lt;_Elem,_Traits&gt; &amp;,const std::error_code &amp;)&quot;: template-Argument für &quot;std::basic_ostream&lt;_Elem,_Traits&gt; &amp;&quot; konnte nicht von &quot;std::istream&quot; hergeleitet werden.</p>
<p>Und hier der Text:</p>
<pre><code>#include &quot;iostream&quot;
using namespace std;

int main ()
{
	int fEntscheidung;
	int fAuswahl;
	int f1Zahl;
    int f2Zahl;

	cout &lt;&lt;&quot;Willkommen in meinem Rechenprogramm&quot;&lt;&lt;endl;
	cout &lt;&lt;&quot;Bitte geben sie ihre Rechenart an: \n1 = +\n2=-\n3=*\n4=/&quot;&lt;&lt;endl;
	cin &gt;&gt;fAuswahl;

	{

		if (fAuswahl == 1)
			cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl;
	        cin &gt;&gt; f1Zahl;
			cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
			cin &gt;&gt; f2Zahl;

				cout&lt;&lt;&quot;Ihr Ergebnis ist: &quot;&lt;&lt;f1Zahl+f2Zahl&lt;&lt;endl;
	}

	{
		if (fAuswahl == 2)
			cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl;
		    cin &gt;&gt; f1Zahl;
			cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
			cin &gt;&gt; f2Zahl;

			cout &lt;&lt;&quot;Ihr Ergebnis ist: &quot;&lt;&lt;f1Zahl-f2Zahl&lt;&lt;endl;
	}
			{
	if (fAuswahl == 3)
		cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl;
		    cin &gt;&gt; f1Zahl;
			cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
			cin &gt;&gt; f2Zahl;
				cout &lt;&lt;&quot;Ihr Ergebnis ist: &quot;&lt;&lt;f1Zahl-f2Zahl&lt;&lt;endl;
}

{
	if (fAuswahl == 4)
		cout&lt;&lt;&quot;Wollen sie eine Kommazahl (1) oder einen Rest (2)?&quot;&lt;&lt;endl;
		cin &lt;&lt;fEntscheidung;
		system (&quot;pause&quot;);
		if (fEntscheidung == 1)
		cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl;
		    cin &gt;&gt; f1Zahl;
			cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
			cin &gt;&gt; f2Zahl;
				cout &lt;&lt;&quot;Ihr Ergebnis ist: &quot;&lt;&lt;f1Zahl/f2Zahl&lt;&lt;endl;
        if (fEntscheidung == 2)
			cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl;
		    cin &gt;&gt; f1Zahl;
			cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
			cin &gt;&gt; f2Zahl;
				cout &lt;&lt;&quot;Ihr Ergebnis ist: &quot;&lt;&lt;f1Zahl/f2Zahl&lt;&lt;endl;
				cout &lt;&lt;&quot;Ihr Rest ist: &quot;&lt;&lt;f1Zahl%f2Zahl&lt;&lt;endl;

}
system (&quot;pause&quot;);
return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/290612/herleitung</link><generator>RSS for Node</generator><lastBuildDate>Tue, 18 Aug 2026 09:21:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/290612.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 30 Jul 2011 09:57:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Herleitung?! on Sat, 30 Jul 2011 10:07:15 GMT]]></title><description><![CDATA[<p>Hi ich habe mal eine Frage. Ich programmiere noch nicht sehr lang und dies ist mein erstes &quot;größeres&quot; Projekt. Ich weiß nicht was da los ist aber ich bekomme sehr viele Fehlermeldungen. Ich kopiere mal die erste rein da es immer die selbe Fehlermeldung ist:</p>
<p>1&gt;c:\users\daniel spiele\documents\visual studio 2010\projects\rechner\rechner\rechner.cpp(47): error C2784: &quot;std::basic_ostream&lt;_Elem,_Traits&gt; &amp;std::operator &lt;&lt;(std::basic_ostream&lt;_Elem,_Traits&gt; &amp;,const std::error_code &amp;)&quot;: template-Argument für &quot;std::basic_ostream&lt;_Elem,_Traits&gt; &amp;&quot; konnte nicht von &quot;std::istream&quot; hergeleitet werden.</p>
<p>Und hier der Text:</p>
<pre><code>#include &quot;iostream&quot;
using namespace std;

int main ()
{
	int fEntscheidung;
	int fAuswahl;
	int f1Zahl;
    int f2Zahl;

	cout &lt;&lt;&quot;Willkommen in meinem Rechenprogramm&quot;&lt;&lt;endl;
	cout &lt;&lt;&quot;Bitte geben sie ihre Rechenart an: \n1 = +\n2=-\n3=*\n4=/&quot;&lt;&lt;endl;
	cin &gt;&gt;fAuswahl;

	{

		if (fAuswahl == 1)
			cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl;
	        cin &gt;&gt; f1Zahl;
			cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
			cin &gt;&gt; f2Zahl;

				cout&lt;&lt;&quot;Ihr Ergebnis ist: &quot;&lt;&lt;f1Zahl+f2Zahl&lt;&lt;endl;
	}

	{
		if (fAuswahl == 2)
			cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl;
		    cin &gt;&gt; f1Zahl;
			cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
			cin &gt;&gt; f2Zahl;

			cout &lt;&lt;&quot;Ihr Ergebnis ist: &quot;&lt;&lt;f1Zahl-f2Zahl&lt;&lt;endl;
	}
			{
	if (fAuswahl == 3)
		cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl;
		    cin &gt;&gt; f1Zahl;
			cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
			cin &gt;&gt; f2Zahl;
				cout &lt;&lt;&quot;Ihr Ergebnis ist: &quot;&lt;&lt;f1Zahl-f2Zahl&lt;&lt;endl;
}

{
	if (fAuswahl == 4)
		cout&lt;&lt;&quot;Wollen sie eine Kommazahl (1) oder einen Rest (2)?&quot;&lt;&lt;endl;
		cin &lt;&lt;fEntscheidung;
		system (&quot;pause&quot;);
		if (fEntscheidung == 1)
		cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl;
		    cin &gt;&gt; f1Zahl;
			cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
			cin &gt;&gt; f2Zahl;
				cout &lt;&lt;&quot;Ihr Ergebnis ist: &quot;&lt;&lt;f1Zahl/f2Zahl&lt;&lt;endl;
        if (fEntscheidung == 2)
			cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl;
		    cin &gt;&gt; f1Zahl;
			cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
			cin &gt;&gt; f2Zahl;
				cout &lt;&lt;&quot;Ihr Ergebnis ist: &quot;&lt;&lt;f1Zahl/f2Zahl&lt;&lt;endl;
				cout &lt;&lt;&quot;Ihr Rest ist: &quot;&lt;&lt;f1Zahl%f2Zahl&lt;&lt;endl;

}
system (&quot;pause&quot;);
return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2099764</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2099764</guid><dc:creator><![CDATA[Cybogg]]></dc:creator><pubDate>Sat, 30 Jul 2011 10:07:15 GMT</pubDate></item><item><title><![CDATA[Reply to Herleitung?! on Sat, 30 Jul 2011 10:05:40 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">cin &lt;&lt;fEntscheidung;
</code></pre>
<p>muss</p>
<pre><code class="language-cpp">cin &gt;&gt; fEntscheidung;
</code></pre>
<p>sein. Übrigens ist es üblicher, Systemheader mit &lt;&gt; einzuschließen, d.h.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2099768</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2099768</guid><dc:creator><![CDATA[seldon]]></dc:creator><pubDate>Sat, 30 Jul 2011 10:05:40 GMT</pubDate></item><item><title><![CDATA[Reply to Herleitung?! on Sat, 30 Jul 2011 10:30:04 GMT]]></title><description><![CDATA[<p>Was genau bringt eigentlich das &quot;f&quot; am Anfang der Variablennamen?</p>
<p>Übrigens solltest du die Codeduplizierung vermeiden und ähnlichen oder sogar gleichen Code zusammenfassen. Auch <code>switch</code> und Funktionen wären eine Idee. Zudem würde ich Variablen so spät wie möglich deklarieren, also erst wenn sie gebraucht werden. Und wie das mit den Blöcken funktioniert, kannst du dir auch gleich nochmals anschauen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2099775</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2099775</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sat, 30 Jul 2011 10:30:04 GMT</pubDate></item><item><title><![CDATA[Reply to Herleitung?! on Sat, 30 Jul 2011 10:38:41 GMT]]></title><description><![CDATA[<p>Nexus schrieb:</p>
<blockquote>
<p>Und wie das mit den Blöcken funktioniert, kannst du dir auch gleich nochmals anschauen...</p>
</blockquote>
<p>Ich mach's doch mal genauer...</p>
<p>Deine if-Abfragen machen nicht, was du vielleicht denkst! if-Abfragen ohne geschweifte Klammer bedingen immer nur eine Zeile. Du möchstest allerdings mehrere Anweisungen bedingen.</p>
<p>falsch:</p>
<pre><code class="language-cpp">if (fAuswahl == 1)
            cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl; //wenn Auswahl!=1 ist, wird NUR DIESE ZEILE nicht ausgeführt, die folgenden Zeilen haben nichts mehr mit dem if-Statement zu tun!
            cin &gt;&gt; f1Zahl;
            cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
            cin &gt;&gt; f2Zahl;
</code></pre>
<p>richtig:</p>
<pre><code class="language-cpp">if (fAuswahl == 1) { //mit geschweifter Klammer gehören alle eingeschlossenen Zeilen zum if
            cout &lt;&lt;&quot;Geben sie ihre erste Zahl ein: &quot;&lt;&lt;endl;
            cin &gt;&gt; f1Zahl;
            cout &lt;&lt;&quot;Geben sie ihre zweite Zahl ein: &quot;&lt;&lt;endl;
            cin &gt;&gt; f2Zahl;
        }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2099777</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2099777</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Sat, 30 Jul 2011 10:38:41 GMT</pubDate></item></channel></rss>