<?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[Keine Kommaausgabe bei floatberechnung]]></title><description><![CDATA[<p>Hi, ich verstehe nicht ganz, weshalb bei den Floatberechnungen keine Kommazahlen ausgegeben werden..</p>
<p>Wenn man bei der letzten Aufgabe + statt * macht wird ein Komma angezeigt..</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

template &lt;typename T&gt;
T Test (T bullshit, T bullshit2)
{
	T ergebnis;
	ergebnis = bullshit*bullshit2;
	return ergebnis;
};
template &lt;typename T, typename R&gt;
T Test2 (T bla1, R bla2)
{
	T TErgebnis;
	R RErgebnis;

	TErgebnis = bla1*bla2;

	return TErgebnis;
};	

int main () {

	int zahl = 99;
	int zahl2 = 200;
	int realergebnis;
	float fzahl = 391.39;
	float fzahl2 = 493.23;
	float frealergebnis;
	float bullshit;
	float testtest;

Test (zahl, zahl2);
realergebnis = Test (zahl, zahl2);	
cout &lt;&lt; realergebnis;

cout &lt;&lt; endl &lt;&lt; endl;

Test (fzahl, fzahl2);
frealergebnis = Test (fzahl, fzahl2);
cout &lt;&lt; frealergebnis;

cout &lt;&lt; endl &lt;&lt; endl;

Test2 (zahl, fzahl2);
bullshit = Test2 (zahl, fzahl2);
cout &lt;&lt; bullshit;

cout &lt;&lt; endl &lt;&lt; endl;
testtest = fzahl * fzahl2;
cout &lt;&lt; testtest;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/321238/keine-kommaausgabe-bei-floatberechnung</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Jul 2026 23:00:15 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/321238.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 29 Oct 2013 11:25:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Keine Kommaausgabe bei floatberechnung on Tue, 29 Oct 2013 11:25:04 GMT]]></title><description><![CDATA[<p>Hi, ich verstehe nicht ganz, weshalb bei den Floatberechnungen keine Kommazahlen ausgegeben werden..</p>
<p>Wenn man bei der letzten Aufgabe + statt * macht wird ein Komma angezeigt..</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

template &lt;typename T&gt;
T Test (T bullshit, T bullshit2)
{
	T ergebnis;
	ergebnis = bullshit*bullshit2;
	return ergebnis;
};
template &lt;typename T, typename R&gt;
T Test2 (T bla1, R bla2)
{
	T TErgebnis;
	R RErgebnis;

	TErgebnis = bla1*bla2;

	return TErgebnis;
};	

int main () {

	int zahl = 99;
	int zahl2 = 200;
	int realergebnis;
	float fzahl = 391.39;
	float fzahl2 = 493.23;
	float frealergebnis;
	float bullshit;
	float testtest;

Test (zahl, zahl2);
realergebnis = Test (zahl, zahl2);	
cout &lt;&lt; realergebnis;

cout &lt;&lt; endl &lt;&lt; endl;

Test (fzahl, fzahl2);
frealergebnis = Test (fzahl, fzahl2);
cout &lt;&lt; frealergebnis;

cout &lt;&lt; endl &lt;&lt; endl;

Test2 (zahl, fzahl2);
bullshit = Test2 (zahl, fzahl2);
cout &lt;&lt; bullshit;

cout &lt;&lt; endl &lt;&lt; endl;
testtest = fzahl * fzahl2;
cout &lt;&lt; testtest;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2363669</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2363669</guid><dc:creator><![CDATA[kamelkacke]]></dc:creator><pubDate>Tue, 29 Oct 2013 11:25:04 GMT</pubDate></item><item><title><![CDATA[Reply to Keine Kommaausgabe bei floatberechnung on Tue, 29 Oct 2013 11:40:27 GMT]]></title><description><![CDATA[<p>Die Zahlen sind schlicht länger als die Standardanzeigegenauigkeit der ostreams. Das hat auch einen Grund, nämlich dass float ohnehin nur ungefähr 7 Dezimalstellen genau ist, die Nachkommastellen hier also ohnehin mit Vorsicht zu genießen wären.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2363672</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2363672</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 29 Oct 2013 11:40:27 GMT</pubDate></item><item><title><![CDATA[Reply to Keine Kommaausgabe bei floatberechnung on Tue, 29 Oct 2013 11:42:09 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich glaub standardmäßig werden bei Fließkommazahlen immer nur 6 Stellen angezeigt. Und da vor dem Komma bereits 6 Stellen sind, werden eben keine Nachkommastellen angezeigt. Versuch mal</p>
<pre><code>cout &lt;&lt; fixed &lt;&lt; setprecision( 10 ) &lt;&lt; testtest;
</code></pre>
<p>Bitte das nächste mal richtig einrücken. Außerdem nur das Posten was wichtig ist. Wenn es nur um die letze Ausgabe geht, interessieren mich die 10 Zeilen drüber nicht... kostet alles Zeit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2363673</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2363673</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Tue, 29 Oct 2013 11:42:09 GMT</pubDate></item><item><title><![CDATA[Reply to Keine Kommaausgabe bei floatberechnung on Tue, 29 Oct 2013 11:55:08 GMT]]></title><description><![CDATA[<p>Der compiler sagt setprecision wurde nicht deklariert. Ansonsten kommt man da wohl mit prtinf weiter oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2363676</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2363676</guid><dc:creator><![CDATA[kamelkacke]]></dc:creator><pubDate>Tue, 29 Oct 2013 11:55:08 GMT</pubDate></item><item><title><![CDATA[Reply to Keine Kommaausgabe bei floatberechnung on Tue, 29 Oct 2013 12:00:07 GMT]]></title><description><![CDATA[<p>kamelkacke schrieb:</p>
<blockquote>
<p>Ansonsten kommt man da wohl mit prtinf weiter oder?</p>
</blockquote>
<p>mir printf kommst du bestimmt nicht weiter, sondern du bewegst dich zurück (zeitlich gesehen).</p>
<p>Ansonsten:</p>
<ol>
<li>google &quot;setprecision&quot;</li>
<li>erster Link &quot;setprecision - C++ Reference&quot;</li>
<li>benötigten Header &lt;iomapin&gt; raussuchen</li>
<li>kompilieren</li>
</ol>
]]></description><link>https://www.c-plusplus.net/forum/post/2363677</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2363677</guid><dc:creator><![CDATA[daddy_felix]]></dc:creator><pubDate>Tue, 29 Oct 2013 12:00:07 GMT</pubDate></item><item><title><![CDATA[Reply to Keine Kommaausgabe bei floatberechnung on Tue, 29 Oct 2013 12:14:10 GMT]]></title><description><![CDATA[<p>Allrighty danke an alle!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2363680</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2363680</guid><dc:creator><![CDATA[kamelkacke]]></dc:creator><pubDate>Tue, 29 Oct 2013 12:14:10 GMT</pubDate></item><item><title><![CDATA[Reply to Keine Kommaausgabe bei floatberechnung on Tue, 29 Oct 2013 14:33:31 GMT]]></title><description><![CDATA[<p>daddy_felix schrieb:</p>
<blockquote>
<ol start="3">
<li>benötigten Header &lt;iomapin&gt; raussuchen</li>
</ol>
</blockquote>
<p>-&gt; &lt;iomanip&gt;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2363702</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2363702</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Tue, 29 Oct 2013 14:33:31 GMT</pubDate></item></channel></rss>