<?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[Falsche Zahldarstellung]]></title><description><![CDATA[<p>Hallo also ich habe mir einen Umrechner programmiert das problem ist nur das die Kommazahl falsch dargestellt wird. zb 15000 Euro sind 2146520 Yen aber die Konsole spuckt dann 21465e+006 Yen. Als Datentyp habe ich double gewählt. Was hab ich falsch gemacht und wie korrigier ich das ??</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/324320/falsche-zahldarstellung</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 22:38:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/324320.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 12 Mar 2014 10:08:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Falsche Zahldarstellung on Wed, 12 Mar 2014 11:23:50 GMT]]></title><description><![CDATA[<p>Hallo also ich habe mir einen Umrechner programmiert das problem ist nur das die Kommazahl falsch dargestellt wird. zb 15000 Euro sind 2146520 Yen aber die Konsole spuckt dann 21465e+006 Yen. Als Datentyp habe ich double gewählt. Was hab ich falsch gemacht und wie korrigier ich das ??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388409</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388409</guid><dc:creator><![CDATA[Sebistyla24]]></dc:creator><pubDate>Wed, 12 Mar 2014 11:23:50 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Wed, 12 Mar 2014 10:21:40 GMT]]></title><description><![CDATA[<p>siehe <a href="http://www.cplusplus.com/reference/ios/fixed/" rel="nofollow">fixed versus scientific</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388413</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388413</guid><dc:creator><![CDATA[kkaw]]></dc:creator><pubDate>Wed, 12 Mar 2014 10:21:40 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Wed, 12 Mar 2014 10:22:55 GMT]]></title><description><![CDATA[<p>Die Wahl von Fließkommazahlen für Geldbeträge ist allgemein sehr, sehr ungünstig. Auch wenn es nicht direkt mit deinem Problem zu tun hat, wirst du damit Probleme bekommen. Nimm einen Ganzzahltyp.</p>
<p>Deine Ausgabe ist durchaus korrekt, bloß die Darstellung ist standardmäßig eine andere, als du anscheinend denkst. Du kannst die Darstellung von Zahlen mit den format-Flags anpassen:<br />
<a href="http://www.cplusplus.com/reference/ios/" rel="nofollow">http://www.cplusplus.com/reference/ios/</a></p>
<pre><code>// modify floatfield
#include &lt;iostream&gt;     // std::cout, std::fixed, std::scientific

int main () {
  double a = 3.1415926534;
  double b = 2006.0;
  double c = 1.0e-10;

  std::cout.precision(5);

  std::cout &lt;&lt; &quot;default:\n&quot;;
  std::cout &lt;&lt; a &lt;&lt; '\n' &lt;&lt; b &lt;&lt; '\n' &lt;&lt; c &lt;&lt; '\n';

  std::cout &lt;&lt; '\n';

  std::cout &lt;&lt; &quot;fixed:\n&quot; &lt;&lt; std::fixed;
  std::cout &lt;&lt; a &lt;&lt; '\n' &lt;&lt; b &lt;&lt; '\n' &lt;&lt; c &lt;&lt; '\n';

  std::cout &lt;&lt; '\n';

  std::cout &lt;&lt; &quot;scientific:\n&quot; &lt;&lt; std::scientific;
  std::cout &lt;&lt; a &lt;&lt; '\n' &lt;&lt; b &lt;&lt; '\n' &lt;&lt; c &lt;&lt; '\n';
  return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2388414</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388414</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 12 Mar 2014 10:22:55 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Wed, 12 Mar 2014 11:23:33 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Die Wahl von Fließkommazahlen für Geldbeträge ist allgemein sehr, sehr ungünstig. Auch wenn es nicht direkt mit deinem Problem zu tun hat, wirst du damit Probleme bekommen. Nimm einen Ganzzahltyp.</p>
<p>Deine Ausgabe ist durchaus korrekt, bloß die Darstellung ist standardmäßig eine andere, als du anscheinend denkst. Du kannst die Darstellung von Zahlen mit den format-Flags anpassen:<br />
<a href="http://www.cplusplus.com/reference/ios/" rel="nofollow">http://www.cplusplus.com/reference/ios/</a></p>
<pre><code>// modify floatfield
#include &lt;iostream&gt;     // std::cout, std::fixed, std::scientific

int main () {
  double a = 3.1415926534;
  double b = 2006.0;
  double c = 1.0e-10;

  std::cout.precision(5);

  std::cout &lt;&lt; &quot;default:\n&quot;;
  std::cout &lt;&lt; a &lt;&lt; '\n' &lt;&lt; b &lt;&lt; '\n' &lt;&lt; c &lt;&lt; '\n';

  std::cout &lt;&lt; '\n';

  std::cout &lt;&lt; &quot;fixed:\n&quot; &lt;&lt; std::fixed;
  std::cout &lt;&lt; a &lt;&lt; '\n' &lt;&lt; b &lt;&lt; '\n' &lt;&lt; c &lt;&lt; '\n';

  std::cout &lt;&lt; '\n';

  std::cout &lt;&lt; &quot;scientific:\n&quot; &lt;&lt; std::scientific;
  std::cout &lt;&lt; a &lt;&lt; '\n' &lt;&lt; b &lt;&lt; '\n' &lt;&lt; c &lt;&lt; '\n';
  return 0;
}
</code></pre>
</blockquote>
<p>mit Flags meinste zb. &lt;&lt; std::fixed; oder ?? Bin noch neu in dieser Materie <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>edit: wenn ich das so mache zeigt er mir komischerweise erst beim 2. durchlauf das richtige ergebnis an mit richtiger darstellung. kappier das nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388416</guid><dc:creator><![CDATA[Sebistyla24]]></dc:creator><pubDate>Wed, 12 Mar 2014 11:23:33 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Wed, 12 Mar 2014 11:43:48 GMT]]></title><description><![CDATA[<p>Sebistyla24 schrieb:</p>
<blockquote>
<p>edit: wenn ich das so mache zeigt er mir komischerweise erst beim 2. durchlauf das richtige ergebnis an mit richtiger darstellung. kappier das nicht</p>
</blockquote>
<p>Wenn du was wie machst? Wir können nicht in deinen Kopf gucken.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388424</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388424</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 12 Mar 2014 11:43:48 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Wed, 12 Mar 2014 21:53:05 GMT]]></title><description><![CDATA[<p>wenn ich das so mache wie in dem Beispiel von dir mit std::fixed dann zeigt die konsole mir erst im 2. durchlauf die richtige darstellung an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388557</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388557</guid><dc:creator><![CDATA[Sebistyla24]]></dc:creator><pubDate>Wed, 12 Mar 2014 21:53:05 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Wed, 12 Mar 2014 23:03:43 GMT]]></title><description><![CDATA[<p>Sebistyla24 schrieb:</p>
<blockquote>
<p>wenn ich das so mache wie in dem Beispiel von dir mit std::fixed dann zeigt die konsole mir erst im 2. durchlauf die richtige darstellung an.</p>
</blockquote>
<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="😕"
    /> Die Ausgabe von dem Beispiel soll</p>
<pre><code>default:
3.1416
2006
1e-010

fixed:
3.14159
2006.00000
0.00000

scientific:
3.14159e+000
2.00600e+003
1.00000e-010
</code></pre>
<p>oder ähnlich sein. Ist das bei dir nicht so?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388567</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388567</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 12 Mar 2014 23:03:43 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Thu, 13 Mar 2014 08:23:02 GMT]]></title><description><![CDATA[<p>doch aber erst wenn das programm ein 2. mal durchläuft beim erstenmal noch nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388603</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388603</guid><dc:creator><![CDATA[Sebistyla24]]></dc:creator><pubDate>Thu, 13 Mar 2014 08:23:02 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Thu, 13 Mar 2014 09:41:22 GMT]]></title><description><![CDATA[<p>Ja dann zeig doch mal, was beim ersten Durchlauf angezeigt wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388624</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388624</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Thu, 13 Mar 2014 09:41:22 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Thu, 13 Mar 2014 09:45:12 GMT]]></title><description><![CDATA[<p>MFK schrieb:</p>
<blockquote>
<p>Ja dann zeig doch mal, was beim ersten Durchlauf angezeigt wird.</p>
</blockquote>
<p>1. Durchlauf 15000.0 EUR sind 21465e+006 JPY</p>
<p>2. Durchlauf 15000.0 EUR sind 2146500.000000 JPY</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388628</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388628</guid><dc:creator><![CDATA[Sebistyla24]]></dc:creator><pubDate>Thu, 13 Mar 2014 09:45:12 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Thu, 13 Mar 2014 09:53:47 GMT]]></title><description><![CDATA[<p>Und wie sieht der Code dazu aus?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388632</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388632</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Thu, 13 Mar 2014 09:53:47 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Thu, 13 Mar 2014 10:24:43 GMT]]></title><description><![CDATA[<pre><code>#include &quot;Funktion.h&quot;

double euro;
double yen;
double faktoryen = 143.10;
double faktoreuro = 0.00699;

double rechnenEuroYen()
{
	cout &lt;&lt; &quot;Euro in Yen\n&quot;;
	cout &lt;&lt; &quot;Bitte geben sie ihren Euro betrag ein (mit Komma (.) Bsp: 15000.0 EUR)\n&quot;;
	cout &lt;&lt; &quot;Euro: &quot;;
	cin &gt;&gt; euro;

	getchar();

	cout &lt;&lt; euro &lt;&lt; &quot; EUR sind umgerechnet &quot; &lt;&lt; euro * faktoryen &lt;&lt; std::fixed &lt;&lt; &quot; JPY&quot;;

	return euro;
}

double rechnenYenEuro()
{
	cout &lt;&lt; &quot;Yen in Euro\n&quot;;
	cout &lt;&lt; &quot;Bitte geben sie ihren Yen betrag ein (mit Komma (.) Bsp: 15000.0 JPY)\n&quot;;
	cout &lt;&lt; &quot;Yen: &quot;;
	cin &gt;&gt; yen;

	getchar();

	cout &lt;&lt; yen &lt;&lt; &quot; JPY sind umgerechnet &quot; &lt;&lt; yen * faktoreuro &lt;&lt; std::fixed &lt;&lt; &quot; EUR&quot;;

	return yen;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2388640</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388640</guid><dc:creator><![CDATA[Sebistyla24]]></dc:creator><pubDate>Thu, 13 Mar 2014 10:24:43 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Thu, 13 Mar 2014 10:28:12 GMT]]></title><description><![CDATA[<p>So viel zu &quot;so wie im Beispiel&quot;.</p>
<p>Du musst std::fixed <strong>vor</strong> dem Wert in den Stream stecken, nicht danach.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388642</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388642</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Thu, 13 Mar 2014 10:28:12 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Zahldarstellung on Thu, 13 Mar 2014 10:51:46 GMT]]></title><description><![CDATA[<p>super vielen dank. bin noch anfänger.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2388648</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2388648</guid><dc:creator><![CDATA[Sebistyla24]]></dc:creator><pubDate>Thu, 13 Mar 2014 10:51:46 GMT</pubDate></item></channel></rss>