<?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[Char oder String...]]></title><description><![CDATA[<p>Hi Leute,<br />
nzahl ist eine String-Variable.<br />
Ich möchte gerne nzahl durch sich selbst PLUS den Stringbuchstaben, welches im String &quot;t&quot; an zweiter Stelle gespeichert ist erhöhen.<br />
Lasse ich das &quot;String&quot; weg, so funktioniert das zwar- mir wird dann aber der dezimale Asciiwert dazu addiert- das möchte ich nicht.<br />
Mit String wird jedoch der Fehler ausgegeben, dass die Funktion keinen &quot;char&quot; als ersten Parameter erlaubt.<br />
Obwohl es doch eigentlich ein String ist...</p>
<p>Kann mir jemand helfen?</p>
<pre><code>nzahl=nzahl+String(t[2],1);
</code></pre>
<p>cya<br />
David</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/173504/char-oder-string</link><generator>RSS for Node</generator><lastBuildDate>Fri, 18 Sep 2026 07:43:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/173504.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 16 Feb 2007 16:36:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Char oder String... on Fri, 16 Feb 2007 16:36:20 GMT]]></title><description><![CDATA[<p>Hi Leute,<br />
nzahl ist eine String-Variable.<br />
Ich möchte gerne nzahl durch sich selbst PLUS den Stringbuchstaben, welches im String &quot;t&quot; an zweiter Stelle gespeichert ist erhöhen.<br />
Lasse ich das &quot;String&quot; weg, so funktioniert das zwar- mir wird dann aber der dezimale Asciiwert dazu addiert- das möchte ich nicht.<br />
Mit String wird jedoch der Fehler ausgegeben, dass die Funktion keinen &quot;char&quot; als ersten Parameter erlaubt.<br />
Obwohl es doch eigentlich ein String ist...</p>
<p>Kann mir jemand helfen?</p>
<pre><code>nzahl=nzahl+String(t[2],1);
</code></pre>
<p>cya<br />
David</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1229658</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1229658</guid><dc:creator><![CDATA[777]]></dc:creator><pubDate>Fri, 16 Feb 2007 16:36:20 GMT</pubDate></item><item><title><![CDATA[Reply to Char oder String... on Fri, 16 Feb 2007 17:26:31 GMT]]></title><description><![CDATA[<p>der konstriktor passt nicht so ganz:</p>
<pre><code class="language-cpp">explicit string ( );
string ( const string&amp; str );
string ( const string&amp; str, size_t pos, size_t n = npos );
string ( const char * s, size_t n );
string ( const char * s );
string ( size_t n, char c );
template&lt;class InputIterator&gt; string (InputIterator begin, InputIterator end);
</code></pre>
<p>du solltest eher die 6. Variante nehmen, also</p>
<pre><code class="language-cpp">string(1, t[2])
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1229679</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1229679</guid><dc:creator><![CDATA[bill bones]]></dc:creator><pubDate>Fri, 16 Feb 2007 17:26:31 GMT</pubDate></item><item><title><![CDATA[Reply to Char oder String... on Fri, 16 Feb 2007 17:44:56 GMT]]></title><description><![CDATA[<p>Um einen char an einen string anzuhängen geht auch push_back().</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1229691</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1229691</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Fri, 16 Feb 2007 17:44:56 GMT</pubDate></item><item><title><![CDATA[Reply to Char oder String... on Fri, 16 Feb 2007 18:03:00 GMT]]></title><description><![CDATA[<p>Oha- er gibt mir den selben Fehler nur umgekehrt...<br />
Zu Push_back() kann ich nichts im Netz finden...</p>
<p>PS: t[1] ist ja kein char- ein Stringteil.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1229698</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1229698</guid><dc:creator><![CDATA[777]]></dc:creator><pubDate>Fri, 16 Feb 2007 18:03:00 GMT</pubDate></item><item><title><![CDATA[Reply to Char oder String... on Fri, 16 Feb 2007 18:16:48 GMT]]></title><description><![CDATA[<p>Ohh- es geht ganz ohne zweites Parameter:</p>
<pre><code>nzahl+=String(t[b]);
</code></pre>
<p>Problem gelöst x.x.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1229714</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1229714</guid><dc:creator><![CDATA[777]]></dc:creator><pubDate>Fri, 16 Feb 2007 18:16:48 GMT</pubDate></item><item><title><![CDATA[Reply to Char oder String... on Fri, 16 Feb 2007 18:17:16 GMT]]></title><description><![CDATA[<p>Wenn nzahl und t ein string sind, würde das so gehen.</p>
<pre><code class="language-cpp">nzahl.push_back(t[2]);
</code></pre>
<p>push_back ist eine Memberfunktion von std::string.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1229715</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1229715</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Fri, 16 Feb 2007 18:17:16 GMT</pubDate></item></channel></rss>