<?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[Strings addieren wie mache ich es?]]></title><description><![CDATA[<p>Hallo alle zusammen</p>
<p>Ich habe ewigkeit nicht mit c++ programiert und muss jetzt was programmieren und komme einfach nicht dahinter ^^. Java ist ja hammer geil im gegensatz zu c++ ^^<br />
Aber ich muss durch<br />
Ich habe also ein String und möchte folgendes machen</p>
<p>string s = &quot;Hallo&quot; + getID() + &quot;,&quot; + &quot;wie gehts dir&quot;;</p>
<p>Die funktion getID() liefert einen int. Der Compiler meldet fehler. Bzw nicht der Compiler, ich kann ja nicht mal <a href="http://kompelieren.Er" rel="nofollow">kompelieren.Er</a> schreibt &quot;expresion must have integral or enum type&quot;.<br />
Was zum kuku ist das? Wie soll ich die Strings den sonst addieren? Kann mir jemand helfen bitte?<br />
Sitze echt schon seit 4 stunden an einem Problem und komme nicht weiter einfach.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/275783/strings-addieren-wie-mache-ich-es</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 16:16:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/275783.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 Oct 2010 20:55:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Strings addieren wie mache ich es? on Wed, 20 Oct 2010 20:59:00 GMT]]></title><description><![CDATA[<p>Hallo alle zusammen</p>
<p>Ich habe ewigkeit nicht mit c++ programiert und muss jetzt was programmieren und komme einfach nicht dahinter ^^. Java ist ja hammer geil im gegensatz zu c++ ^^<br />
Aber ich muss durch<br />
Ich habe also ein String und möchte folgendes machen</p>
<p>string s = &quot;Hallo&quot; + getID() + &quot;,&quot; + &quot;wie gehts dir&quot;;</p>
<p>Die funktion getID() liefert einen int. Der Compiler meldet fehler. Bzw nicht der Compiler, ich kann ja nicht mal <a href="http://kompelieren.Er" rel="nofollow">kompelieren.Er</a> schreibt &quot;expresion must have integral or enum type&quot;.<br />
Was zum kuku ist das? Wie soll ich die Strings den sonst addieren? Kann mir jemand helfen bitte?<br />
Sitze echt schon seit 4 stunden an einem Problem und komme nicht weiter einfach.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968248</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968248</guid><dc:creator><![CDATA[donni1982]]></dc:creator><pubDate>Wed, 20 Oct 2010 20:59:00 GMT</pubDate></item><item><title><![CDATA[Reply to Strings addieren wie mache ich es? on Wed, 20 Oct 2010 21:02:26 GMT]]></title><description><![CDATA[<p>versuch mal</p>
<p>char buffer[256];</p>
<p>sprintf(buffer, &quot;Hallo %d bla bla bla&quot;,getID());</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968253</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968253</guid><dc:creator><![CDATA[LEO_III]]></dc:creator><pubDate>Wed, 20 Oct 2010 21:02:26 GMT</pubDate></item><item><title><![CDATA[Reply to Strings addieren wie mache ich es? on Wed, 20 Oct 2010 21:05:37 GMT]]></title><description><![CDATA[<p>LEO_III schrieb:</p>
<blockquote>
<p>versuch mal</p>
<p>char buffer[256];</p>
<p>sprintf(buffer, &quot;Hallo %d bla bla bla&quot;,getID());</p>
</blockquote>
<p>Oder du lässt das bleiben (weil C und kein C++), informierst dich darüber was der Unterschied zwischen strings und string-literalen ist und verwendest dann nen stringstream.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968254</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968254</guid><dc:creator><![CDATA[inter2k3]]></dc:creator><pubDate>Wed, 20 Oct 2010 21:05:37 GMT</pubDate></item><item><title><![CDATA[Reply to Strings addieren wie mache ich es? on Wed, 20 Oct 2010 21:26:31 GMT]]></title><description><![CDATA[<p>hmmm</p>
<p>also ich habe folgendes herausgefunden:<br />
stringstream d;<br />
d&lt;&lt;getClubID();<br />
string s = &quot;Hallo&quot; + d.str() + &quot;,&quot; + &quot;wie gehts dir&quot;;</p>
<p>Anderen guten bzw. den besten Weg gibt es nicht ne? Außer, dass ich jeden Buchstaben nehme und ins char umwandele usw.....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968264</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968264</guid><dc:creator><![CDATA[donni1982]]></dc:creator><pubDate>Wed, 20 Oct 2010 21:26:31 GMT</pubDate></item><item><title><![CDATA[Reply to Strings addieren wie mache ich es? on Wed, 20 Oct 2010 21:31:09 GMT]]></title><description><![CDATA[<p>Mit boost geht's so:</p>
<pre><code class="language-cpp">#include &lt;boost/lexical_cast.hpp&gt;
#include &lt;string&gt;
#include &lt;iostream&gt;

int main()
{
  std::string s;
  s = std::string( &quot;Hallo &quot; ) + boost::lexical_cast&lt;std::string&gt;( 42 );

  std::cerr &lt;&lt; s &lt;&lt; std::endl;
}
</code></pre>
<p>Boost sollte aug jedem guten C++-Entwicklungsrechner installiert sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968266</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968266</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 20 Oct 2010 21:31:09 GMT</pubDate></item><item><title><![CDATA[Reply to Strings addieren wie mache ich es? on Wed, 20 Oct 2010 21:31:52 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">ostringstream oss;
oss&lt;&lt;&quot;Hallo &quot;&lt;&lt;getClubID()&lt;&lt;&quot;, wie gehts dir?&quot;;

string s = oss.str();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1968267</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968267</guid><dc:creator><![CDATA[inter2k3]]></dc:creator><pubDate>Wed, 20 Oct 2010 21:31:52 GMT</pubDate></item></channel></rss>