<?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[Konvertierung von &#x27;float&#x27; in &#x27;int&#x27;, moeglicher Datenverlust]]></title><description><![CDATA[<p>Hi,</p>
<p>kann mir bitte jemand das erklären, wieso immer wieder beim kompilieren diese Fehlermeldung erscheint ? Ich benutze den Visual C++ Kopiler.</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &quot;iostream.h&quot;
#include &quot;math.h&quot;

int main(int argc, char* argv[])
{
	int h, v, a, r;
	float pi;
	pi = 3,14159265358979; 
	cout &lt;&lt; &quot;Bitte gebe den Radius und die Hoehe für das Volumen und Mantelflaeche eines Kreiszylinders an!\n&quot;;
	cout &lt;&lt; &quot;Hoehe eingeben: &quot;;
	cin &gt;&gt; h;
	cout &lt;&lt; &quot;\nRadius eingeben: &quot;; 
	cin &gt;&gt; r;
	v = pi*r*r*h;
	a=2*pi*r*h;
	cout &lt;&lt; &quot;\n\nDie Flaeche betraegt: &quot; &lt;&lt; a &lt;&lt; &quot; und das Volumen betraegt &quot; &lt;&lt; v &lt;&lt; &quot;\n\n&quot;; 

	return 0;
}
</code></pre>
<p>lg,<br />
Mr.Homer</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/173606/konvertierung-von-float-in-int-moeglicher-datenverlust</link><generator>RSS for Node</generator><lastBuildDate>Fri, 18 Sep 2026 09:32:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/173606.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 17 Feb 2007 19:07:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Konvertierung von &#x27;float&#x27; in &#x27;int&#x27;, moeglicher Datenverlust on Sat, 17 Feb 2007 19:07:24 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>kann mir bitte jemand das erklären, wieso immer wieder beim kompilieren diese Fehlermeldung erscheint ? Ich benutze den Visual C++ Kopiler.</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &quot;iostream.h&quot;
#include &quot;math.h&quot;

int main(int argc, char* argv[])
{
	int h, v, a, r;
	float pi;
	pi = 3,14159265358979; 
	cout &lt;&lt; &quot;Bitte gebe den Radius und die Hoehe für das Volumen und Mantelflaeche eines Kreiszylinders an!\n&quot;;
	cout &lt;&lt; &quot;Hoehe eingeben: &quot;;
	cin &gt;&gt; h;
	cout &lt;&lt; &quot;\nRadius eingeben: &quot;; 
	cin &gt;&gt; r;
	v = pi*r*r*h;
	a=2*pi*r*h;
	cout &lt;&lt; &quot;\n\nDie Flaeche betraegt: &quot; &lt;&lt; a &lt;&lt; &quot; und das Volumen betraegt &quot; &lt;&lt; v &lt;&lt; &quot;\n\n&quot;; 

	return 0;
}
</code></pre>
<p>lg,<br />
Mr.Homer</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1230275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1230275</guid><dc:creator><![CDATA[Mr.Homer]]></dc:creator><pubDate>Sat, 17 Feb 2007 19:07:24 GMT</pubDate></item><item><title><![CDATA[Reply to Konvertierung von &#x27;float&#x27; in &#x27;int&#x27;, moeglicher Datenverlust on Sat, 17 Feb 2007 19:26:54 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>da dein Volumen und deine Fläche eigentlich immer ein float ergeben bekommst du diese Fehlermeldung. Und du hast für die Fläche und das Volumen nur ein int angeben. Somit werden nach der Berechnung einfach die Kommastellen abgeschnitten.</p>
<p>Gruß Spartaner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1230293</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1230293</guid><dc:creator><![CDATA[Spartaner]]></dc:creator><pubDate>Sat, 17 Feb 2007 19:26:54 GMT</pubDate></item><item><title><![CDATA[Reply to Konvertierung von &#x27;float&#x27; in &#x27;int&#x27;, moeglicher Datenverlust on Sat, 17 Feb 2007 19:33:20 GMT]]></title><description><![CDATA[<p>Danke, du hast Recht <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>lg und schönes we</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1230300</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1230300</guid><dc:creator><![CDATA[Mr.Homer]]></dc:creator><pubDate>Sat, 17 Feb 2007 19:33:20 GMT</pubDate></item><item><title><![CDATA[Reply to Konvertierung von &#x27;float&#x27; in &#x27;int&#x27;, moeglicher Datenverlust on Sun, 18 Feb 2007 11:34:54 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &quot;stdafx.h&quot; // Eigentlich nicht notwendig ... includierst ja alle wichtigen Header schon weiter unten ...
#include &lt;iostream&gt; // #include &quot;iostream.h&quot; ... also der std. Header ist das net ^^
#include &lt;math&gt; // #include &quot;math.h&quot; ... siehe oben ^^

int main()
{
    unsigned int heigth = 0; // Ne negative Höhe? nee ... also unsigned
    unsigned int r = 0; // bei Radius wohl das selbe ...
    float pi= 3.14159265358979; // Gehört ein Punkt hin ...
    std::cout &lt;&lt; &quot;Bitte gebe den Radius und die Hoehe für das Volumen und Mantelflaeche eines Kreiszylinders an!&quot; &lt;&lt; std::endl; // std::endl ... 
    std::cout &lt;&lt; &quot;Hoehe: &quot; &lt;&lt; std::flush;
    std::cin &gt;&gt; heigth;
    std::cout &lt;&lt; &quot;\nRadius: &quot; &lt;&lt; std::flush;
    std::cin &gt;&gt; r;
    std::cout &lt;&lt; &quot;\n\nDie Flaeche betraegt: &quot; &lt;&lt; (2 * pi * r * h) &lt;&lt; &quot; und das Volumen betraegt &quot; &lt;&lt; (pi * r * r * h) &lt;&lt; std::endl;

    return 0;
}
</code></pre>
<p>Solltest noch gucken das der dir nicht raushaut wenn du nen char anstelle einer Zahl eingibst ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1230365</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1230365</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sun, 18 Feb 2007 11:34:54 GMT</pubDate></item><item><title><![CDATA[Reply to Konvertierung von &#x27;float&#x27; in &#x27;int&#x27;, moeglicher Datenverlust on Sun, 18 Feb 2007 10:04:09 GMT]]></title><description><![CDATA[<p>float pi= 3.14159265358979f; ist auch &quot;Müll&quot;. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1230448</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1230448</guid><dc:creator><![CDATA[Erhard Henkes]]></dc:creator><pubDate>Sun, 18 Feb 2007 10:04:09 GMT</pubDate></item><item><title><![CDATA[Reply to Konvertierung von &#x27;float&#x27; in &#x27;int&#x27;, moeglicher Datenverlust on Sun, 18 Feb 2007 18:18:49 GMT]]></title><description><![CDATA[<p>Besser:</p>
<pre><code class="language-cpp">const double PI = std::acos( -1.0 );
</code></pre>
<p>(benötigt '#include &lt;cmath&gt;')</p>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1230774</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1230774</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Sun, 18 Feb 2007 18:18:49 GMT</pubDate></item></channel></rss>