<?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[ich hätte eine frage...]]></title><description><![CDATA[<p>ich habe diese aufgabe und ich habe gelöst aber ich glaube das es ist nicht richtig<br />
kann jemand sehn ob richtig ist oder nicht?</p>
<p>#include &lt;cstdlib&gt;<br />
#include &lt;iostream&gt;</p>
<p>using namespace std;</p>
<p>int main(int argc, char *argv[])<br />
{<br />
/* Schreiben Sie ein Programm, das<br />
den Inhalt dreier Variablen vertauscht.<br />
Die erste Variable soll vom Typ double sein und den Wert 5.6 haben.<br />
Die zweite Variable ist vom Typ int und hat den Wert 7,<br />
und die dritte ist vom Typ float und hat den Wert 3.456.<br />
Benutzen Sie zum Tauschen eine Hilfsvariable des Typs double.<br />
Nach dem Tausch soll der Inhalt der dritten Variable in der<br />
ersten stehen, der Inhalt der zweiten in der dritten und der Inhalt<br />
der ersten in der zweiten. Was beobachten Sie? */</p>
<p>double db = 5.6;<br />
int in = 7;<br />
float fl = 3.456;//<br />
double db1 = fl , db2 = in , db3 = db ;<br />
cout &lt;&lt; &quot; db1: &quot; &lt;&lt; db1 &lt;&lt; &quot;db2: &quot; &lt;&lt; db2 &lt;&lt; &quot; db3: &quot; &lt;&lt; db3 &lt;&lt; endl;</p>
<p>system(&quot;PAUSE&quot;);<br />
return EXIT_SUCCESS;<br />
}<br />
mfg toni<br />
ich wäre dankbar für jede antwort</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/132432/ich-hätte-eine-frage</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 10:46:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/132432.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 10 Jan 2006 20:36:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ich hätte eine frage... on Tue, 10 Jan 2006 20:36:03 GMT]]></title><description><![CDATA[<p>ich habe diese aufgabe und ich habe gelöst aber ich glaube das es ist nicht richtig<br />
kann jemand sehn ob richtig ist oder nicht?</p>
<p>#include &lt;cstdlib&gt;<br />
#include &lt;iostream&gt;</p>
<p>using namespace std;</p>
<p>int main(int argc, char *argv[])<br />
{<br />
/* Schreiben Sie ein Programm, das<br />
den Inhalt dreier Variablen vertauscht.<br />
Die erste Variable soll vom Typ double sein und den Wert 5.6 haben.<br />
Die zweite Variable ist vom Typ int und hat den Wert 7,<br />
und die dritte ist vom Typ float und hat den Wert 3.456.<br />
Benutzen Sie zum Tauschen eine Hilfsvariable des Typs double.<br />
Nach dem Tausch soll der Inhalt der dritten Variable in der<br />
ersten stehen, der Inhalt der zweiten in der dritten und der Inhalt<br />
der ersten in der zweiten. Was beobachten Sie? */</p>
<p>double db = 5.6;<br />
int in = 7;<br />
float fl = 3.456;//<br />
double db1 = fl , db2 = in , db3 = db ;<br />
cout &lt;&lt; &quot; db1: &quot; &lt;&lt; db1 &lt;&lt; &quot;db2: &quot; &lt;&lt; db2 &lt;&lt; &quot; db3: &quot; &lt;&lt; db3 &lt;&lt; endl;</p>
<p>system(&quot;PAUSE&quot;);<br />
return EXIT_SUCCESS;<br />
}<br />
mfg toni<br />
ich wäre dankbar für jede antwort</p>
]]></description><link>https://www.c-plusplus.net/forum/post/963076</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/963076</guid><dc:creator><![CDATA[toni733]]></dc:creator><pubDate>Tue, 10 Jan 2006 20:36:03 GMT</pubDate></item><item><title><![CDATA[Reply to ich hätte eine frage... on Tue, 10 Jan 2006 20:40:27 GMT]]></title><description><![CDATA[<p>ich denke du solltest schon das tun was in der Aufgabe steht ^^.<br />
Also die Variablen tauschen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/963078</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/963078</guid><dc:creator><![CDATA[dreaddy]]></dc:creator><pubDate>Tue, 10 Jan 2006 20:40:27 GMT</pubDate></item><item><title><![CDATA[Reply to ich hätte eine frage... on Tue, 10 Jan 2006 20:43:52 GMT]]></title><description><![CDATA[<p>dh ist falsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/963082</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/963082</guid><dc:creator><![CDATA[toni733]]></dc:creator><pubDate>Tue, 10 Jan 2006 20:43:52 GMT</pubDate></item><item><title><![CDATA[Reply to ich hätte eine frage... on Tue, 10 Jan 2006 20:48:41 GMT]]></title><description><![CDATA[<p>zum &quot;richtigen&quot; Vertauschen musste nachher den Inhalt von db1 in db kopieren, von db2 in in ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/963086</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/963086</guid><dc:creator><![CDATA[Manuelito]]></dc:creator><pubDate>Tue, 10 Jan 2006 20:48:41 GMT</pubDate></item><item><title><![CDATA[Reply to ich hätte eine frage... on Tue, 10 Jan 2006 20:54:50 GMT]]></title><description><![CDATA[<p>kannst du mir vieleicht helfen weil ich verstehe diese nicht<br />
bitte.</p>
<p>mfg toni</p>
]]></description><link>https://www.c-plusplus.net/forum/post/963089</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/963089</guid><dc:creator><![CDATA[toni733]]></dc:creator><pubDate>Tue, 10 Jan 2006 20:54:50 GMT</pubDate></item><item><title><![CDATA[Reply to ich hätte eine frage... on Tue, 10 Jan 2006 21:04:20 GMT]]></title><description><![CDATA[<p>ja, ist falsch.</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;

int main(int argc, char *argv[])
{
double db = 5.6;
int in = 7;
float fl = 3.456;//
double hilf;
 hilf = db; // 1 sichern
 db=fl;// 3 in 1
 fl =in; // 2 in 3
 in=hilf; // 1 in 2
cout &lt;&lt; &quot; db: &quot; &lt;&lt; db &lt;&lt; &quot;in: &quot; &lt;&lt; in &lt;&lt; &quot; fl: &quot; &lt;&lt; fl &lt;&lt; endl;

system(&quot;PAUSE&quot;);
return EXIT_SUCCESS;
}
</code></pre>
<p>ist richtig. ( glaube ich wenigstens <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>
]]></description><link>https://www.c-plusplus.net/forum/post/963095</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/963095</guid><dc:creator><![CDATA[kermit1]]></dc:creator><pubDate>Tue, 10 Jan 2006 21:04:20 GMT</pubDate></item><item><title><![CDATA[Reply to ich hätte eine frage... on Tue, 10 Jan 2006 21:05:17 GMT]]></title><description><![CDATA[<p>ich habe keine andere idde<br />
kann jemand etwas sagen bitte</p>
]]></description><link>https://www.c-plusplus.net/forum/post/963096</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/963096</guid><dc:creator><![CDATA[toni733]]></dc:creator><pubDate>Tue, 10 Jan 2006 21:05:17 GMT</pubDate></item><item><title><![CDATA[Reply to ich hätte eine frage... on Tue, 10 Jan 2006 21:18:02 GMT]]></title><description><![CDATA[<p>ich habe ein bsp die leutet so<br />
#include &lt;iostream&gt;<br />
using namespace std;</p>
<p>int main() {<br />
double db = 12.45;<br />
int in = 0;<br />
bool bo1 = db, bo2 = in;<br />
cout &lt;&lt; &quot;bo1: &quot; &lt;&lt; bo1 &lt;&lt; &quot; bo2: &quot; &lt;&lt; bo2 &lt;&lt; endl;<br />
return 0;<br />
}</p>
<p>und deine lösung ist nicht in diese model.<br />
kannst du mier den unterschied erklären bitte</p>
]]></description><link>https://www.c-plusplus.net/forum/post/963109</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/963109</guid><dc:creator><![CDATA[toni733]]></dc:creator><pubDate>Tue, 10 Jan 2006 21:18:02 GMT</pubDate></item><item><title><![CDATA[Reply to ich hätte eine frage... on Tue, 10 Jan 2006 21:23:44 GMT]]></title><description><![CDATA[<p>bedingt richtig denke ich, es sollten alle Variablen vorher in hilf gespeichert werden und dann zurückgeschrieben werden um alles richtig feststellen zu können was es festzustellen gibt, bei einer konstallation könnte das afaik noch was verändern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/963112</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/963112</guid><dc:creator><![CDATA[dreaddy]]></dc:creator><pubDate>Tue, 10 Jan 2006 21:23:44 GMT</pubDate></item><item><title><![CDATA[Reply to ich hätte eine frage... on Tue, 10 Jan 2006 21:33:10 GMT]]></title><description><![CDATA[<p>toni733 schrieb:</p>
<blockquote>
<p>ich habe ein bsp die leutet so</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

int main() {
    double db = 12.45; 
    int in = 0; 
    bool bo1 = db, bo2 = in; 
    cout &lt;&lt; &quot;bo1: &quot; &lt;&lt; bo1 &lt;&lt; &quot; bo2: &quot; &lt;&lt; bo2 &lt;&lt; endl;
    return 0;
}
</code></pre>
<p>und deine lösung ist nicht in diese model.<br />
kannst du mier den unterschied erklären bitte</p>
</blockquote>
<p>das ist laut der aufgabenstellung definitiv falsch.. der typ bool unterstützt nur false und true..außerdem tauscht du keine variablen sondern belegst nur welche neu, solltest aber hier einen compilerfehler erhalten(wenn nicht, wird alles &gt; 0 als true interpretiert)..</p>
<p>ich würde es so wie kermit lösen und zwar durch zwischenspeichern einer variable.. jedoch funktioniert es glaube ich nicht, da es zu einem kovertierungsfehler kommen sollte..deswegen hier mal nen etwas abgeändertes programm..</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

int main()
{
double db = 5.6;
int in = 7;
float fl = 3.456;
double hilf = db; // db sichern
 db = static_cast&lt;double&gt;(fl); //float nach double konvertieren 
 fl = static_cast&lt;float&gt;(in); // int nach float
 in = static_cast&lt;int&gt;(hilf); // double nach int
std::cout &lt;&lt; &quot; db: &quot; &lt;&lt; db &lt;&lt; &quot;in: &quot; &lt;&lt; in &lt;&lt; &quot; fl: &quot; &lt;&lt; fl &lt;&lt; std::endl;

std::cin.get();
return 0;
}
</code></pre>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/963126</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/963126</guid><dc:creator><![CDATA[P4n1k]]></dc:creator><pubDate>Tue, 10 Jan 2006 21:33:10 GMT</pubDate></item><item><title><![CDATA[Reply to ich hätte eine frage... on Wed, 11 Jan 2006 05:44:15 GMT]]></title><description><![CDATA[<p>er soll doch einfach nur sagen, was er beobachtet.</p>
<p>und? was beobachtest du, toni 733, wenn du den tausch vollziehst von double nach int etc...?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/963215</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/963215</guid><dc:creator><![CDATA[elise]]></dc:creator><pubDate>Wed, 11 Jan 2006 05:44:15 GMT</pubDate></item></channel></rss>