<?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[String sortieren]]></title><description><![CDATA[<p>Wie kann ich eine Funktion für String zum sortieren schreiben?<br />
Beispiel, Meine Funktion soll die Monatname im Alphabetische Reihe ausgeben.<br />
Vielen Dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/181197/string-sortieren</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 15:35:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/181197.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 10 May 2007 21:08:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String sortieren on Thu, 10 May 2007 21:08:05 GMT]]></title><description><![CDATA[<p>Wie kann ich eine Funktion für String zum sortieren schreiben?<br />
Beispiel, Meine Funktion soll die Monatname im Alphabetische Reihe ausgeben.<br />
Vielen Dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1282680</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1282680</guid><dc:creator><![CDATA[afokam]]></dc:creator><pubDate>Thu, 10 May 2007 21:08:05 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Thu, 10 May 2007 21:11:31 GMT]]></title><description><![CDATA[<p>wenn du es schreiben willst dann lies deinen string jedesmal bis zu einem &quot; &quot; ein. und mach teilstrings, diese sortierst du halt durch ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1282681</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1282681</guid><dc:creator><![CDATA[Stelfer]]></dc:creator><pubDate>Thu, 10 May 2007 21:11:31 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Thu, 10 May 2007 21:18:35 GMT]]></title><description><![CDATA[<p>afokam schrieb:</p>
<blockquote>
<p>Wie kann ich eine Funktion für String zum sortieren schreiben?<br />
Beispiel, Meine Funktion soll die Monatname im Alphabetische Reihe ausgeben.<br />
Vielen Dank!</p>
</blockquote>
<p>Am besten gar nicht. Mach dich besser mit der Standardbibliothek vertraut:</p>
<pre><code class="language-cpp">#include &lt;algorithm&gt;

// ...

string monate[] = { /* ... */ };
std::sort(monate, monate+12);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1282685</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1282685</guid><dc:creator><![CDATA[finix]]></dc:creator><pubDate>Thu, 10 May 2007 21:18:35 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Thu, 10 May 2007 21:47:44 GMT]]></title><description><![CDATA[<p>Es klingt schon gut für mich !</p>
<p>danke. Aber ich will es mit pointer und Zeiger schreiben.<br />
können sie mir weiter helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1282695</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1282695</guid><dc:creator><![CDATA[afokam]]></dc:creator><pubDate>Thu, 10 May 2007 21:47:44 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Fri, 11 May 2007 06:08:50 GMT]]></title><description><![CDATA[<p>afokam schrieb:</p>
<blockquote>
<p>danke. Aber ich will es mit pointer und Zeiger schreiben.</p>
</blockquote>
<p>Pointer UND Zeiger - den muß ich mir merken <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<blockquote>
<p>können sie mir weiter helfen?</p>
</blockquote>
<p>Klar, aber dann mußt du natürlich eine eigene Vergleichsfunktion auf strcmp()-Basis bauen und an sort() mitgeben (die Default-Version vergleicht per &quot;kleiner als&quot; - und das ist für &quot;pointer und Zeiger&quot; <strong>nicht</strong> der lexikalische Vergleich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1282755</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1282755</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Fri, 11 May 2007 06:08:50 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 09:46:10 GMT]]></title><description><![CDATA[<p>Ich weißt nicht was hier falsch ist</p>
<p>Ich brauche hilfe</p>
<p>#include&lt;iostream&gt;<br />
#include&lt;string.h&gt;<br />
using namespace std;</p>
<p>//char*month_name(char *n)<br />
int main()</p>
<p>{<br />
static char *name[]={&quot;illegal month&quot;,<br />
&quot;january&quot;,<br />
&quot;February&quot;,<br />
&quot;march&quot;,<br />
&quot;April&quot;,<br />
&quot;May&quot;,<br />
&quot;june&quot;,<br />
&quot;july&quot;,<br />
&quot;August&quot;,<br />
&quot;september&quot;,<br />
&quot;Oktber&quot;,<br />
&quot;november&quot;,<br />
&quot;December&quot;</p>
<p>};<br />
int i;char *ptrname;<br />
{</p>
<p>for(i=0;i&lt;=12;i++)</p>
<p>//cout&lt;&lt;&quot;name[&quot;&lt;&lt;i&lt;&lt;&quot;]=&quot;&lt;&lt;name[i]&lt;&lt;'\n';<br />
ptrname=strchr(name[i],&quot;April&quot;);<br />
while (ptrname!=NULL)<br />
{<br />
printf (&quot;found at %d\n&quot;,name[i]);<br />
//ptrname=strchr(ptrname+1,'April');</p>
<p>}<br />
return 0;</p>
<p>}<br />
}</p>
<p>Das ziel ist die Monaten in alphabetischen Reihe zu ordnen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283882</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283882</guid><dc:creator><![CDATA[afokam]]></dc:creator><pubDate>Sun, 13 May 2007 09:46:10 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 10:03:30 GMT]]></title><description><![CDATA[<p>Ohne jetzt den Fehler in deinem Programm zu suchen: musst du das unter Vorgab so schreiben, oder kannst du beliebige Methoden verwenden? Wenn ja, nutze std::string statt char* und std::sort zum sortieren des arrays (das du auch durch nen vector ersetzen kannst wenn gewollt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283887</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283887</guid><dc:creator><![CDATA[Shinja]]></dc:creator><pubDate>Sun, 13 May 2007 10:03:30 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 10:11:22 GMT]]></title><description><![CDATA[<p>Ich muß zwar nicht schreiben. Aber ich kenne mich von deinem Vorschlag nicht aus.Können sie mir mehr helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283897</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283897</guid><dc:creator><![CDATA[afokam]]></dc:creator><pubDate>Sun, 13 May 2007 10:11:22 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 11:19:09 GMT]]></title><description><![CDATA[<p>Siehe DEvils Post hier drunter, der ist besser.</p>
<p>Bez der einzelnen Sachen wie string, set oder vector empfehele ich <a href="http://www.cppreference.com" rel="nofollow">www.cppreference.com</a> sowie einige Online Tutorials.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283906</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283906</guid><dc:creator><![CDATA[Shinja]]></dc:creator><pubDate>Sun, 13 May 2007 11:19:09 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 10:44:03 GMT]]></title><description><![CDATA[<p>Irgendwie stimmt die Schreibweise der Funktion nicht.<br />
Ich kenne mich nicht aus</p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283914</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283914</guid><dc:creator><![CDATA[afokam]]></dc:creator><pubDate>Sun, 13 May 2007 10:44:03 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 10:55:38 GMT]]></title><description><![CDATA[<p>Nja ... nen vector wenn die Größe statisch ist?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;algorithm&gt;

int main()
{
	const std::size_t month_count = 13;
	std::string arr_month[month_count]={&quot;Januar&quot;, &quot;Februar&quot;, &quot;März&quot;, &quot;April&quot;, &quot;Mai&quot;, &quot;Juni&quot;, &quot;Juli&quot;, &quot;August&quot;, &quot;September&quot;, &quot;Oktober&quot;, &quot;November&quot;, &quot;Dezember&quot;, &quot;Unknown&quot;};

	for (std::size_t month = 0; month &lt; month_count; ++month)
		std::cout &lt;&lt; arr_month[month] &lt;&lt; std::endl;;

	std::cout &lt;&lt; &quot;Sort array!&quot; &lt;&lt; std::endl;
	std::sort(arr_month, arr_month + month_count);
	std::cout &lt;&lt; &quot;Array sorted!&quot; &lt;&lt; std::endl;

	for (std::size_t month = 0; month &lt; month_count; ++month)
		std::cout &lt;&lt; arr_month[month] &lt;&lt; std::endl;
}
</code></pre>
<p>aja und bei dir ist außerdem falsch das dein array const ist ... das kann ja schlecht gehen. <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>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;algorithm&gt;
#include &lt;vector&gt;

int main()
{
	std::vector&lt;std::string&gt; arr_month;
	arr_month.push_back(&quot;Januar&quot;);
	arr_month.push_back(&quot;Februar&quot;);
	arr_month.push_back(&quot;März&quot;);
	arr_month.push_back(&quot;April&quot;);
	arr_month.push_back(&quot;Mai&quot;);
	arr_month.push_back(&quot;Juni&quot;);
	arr_month.push_back(&quot;Juli&quot;);
	arr_month.push_back(&quot;August&quot;);
	arr_month.push_back(&quot;September&quot;);
	arr_month.push_back(&quot;Oktober&quot;);
	arr_month.push_back(&quot;November&quot;);
	arr_month.push_back(&quot;Dezember&quot;);
	arr_month.push_back(&quot;Unknown&quot;};

	for (std::vector&lt;std::string&gt;::iterator it = arr_month.begin(); it != arr_month.end(); ++it)
		std::cout &lt;&lt; (*it) &lt;&lt; std::endl;;

	std::cout &lt;&lt; &quot;Sort array!&quot; &lt;&lt; std::endl;
	std::sort(arr_month.begin(), arr_month.end());
	std::cout &lt;&lt; &quot;Array sorted!&quot; &lt;&lt; std::endl;

	for (std::vector&lt;std::string&gt;::iterator it = arr_month.begin(); it != arr_month.end(); ++it)
		std::cout &lt;&lt; (*it) &lt;&lt; std::endl;;
}
</code></pre>
<p>wenn de unbedingt std::vector haben willst ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283924</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283924</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sun, 13 May 2007 10:55:38 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 11:05:48 GMT]]></title><description><![CDATA[<p>Stimmt, ich arbeite einfach nicht oft genug mit Arrays (oder besser gesagt sizeof) Funktionniert es so? Ich kannes leider atm nicht testen, da ich nichts kompilieren kann.</p>
<p>EDIT: @DEvil: Sry, ist echt ein bisschen over kill. Das const array ist btw ja nur zum vector füllen gedacht gewesen resp. damit man es danach noch hat, falls man es nochmal braucht.<br />
Sry.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283926</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283926</guid><dc:creator><![CDATA[Shinja]]></dc:creator><pubDate>Sun, 13 May 2007 11:05:48 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 10:54:42 GMT]]></title><description><![CDATA[<p>afokam schrieb:</p>
<blockquote>
<p>Ich muß zwar nicht schreiben.</p>
</blockquote>
<p>Dann verwende die Methode von finix, ganz am Anfang des Threads. Wozu willst Du denn hier Zeiger verwenden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283927</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283927</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Sun, 13 May 2007 10:54:42 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 11:12:28 GMT]]></title><description><![CDATA[<p>Wir haben die Antwort!</p>
<p>ompilierung läuft...<br />
main.cpp<br />
C:\Dokumente und Einstellungen\All Users\Desktop\Auf5\main.cpp(76) : error C2374: 'it' : Neudefinition; Mehrfachinitialisierung<br />
C:\Dokumente und Einstellungen\All Users\Desktop\Auf5\main.cpp(69) : Siehe Deklaration von 'it'<br />
C:\Dokumente und Einstellungen\All Users\Desktop\Auf5\main.cpp(78) : warning C4508: 'main' : Funktion sollte einen Wert zurueckgeben; Ergebnistyp 'void' angenommen<br />
Fehler beim Ausführen von cl.exe.</p>
<p>main.obj - 1 Fehler, 1 Warnung(en)</p>
<p>kannst du noch was? <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/1283939</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283939</guid><dc:creator><![CDATA[afokam]]></dc:creator><pubDate>Sun, 13 May 2007 11:12:28 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 11:19:32 GMT]]></title><description><![CDATA[<p>dieser Beitrag :</p>
<p>#include &lt;iostream&gt;<br />
#include &lt;string&gt;<br />
#include &lt;algorithm&gt;</p>
<p>int main()<br />
{<br />
const std::size_t month_count = 13;<br />
std::string arr_month[month_count]={&quot;Januar&quot;, &quot;Februar&quot;, &quot;März&quot;, &quot;April&quot;, &quot;Mai&quot;, &quot;Juni&quot;, &quot;Juli&quot;, &quot;August&quot;, &quot;September&quot;, &quot;Oktober&quot;, &quot;November&quot;, &quot;Dezember&quot;, &quot;Unknown&quot;};</p>
<p>for (std::size_t month = 0; month &lt; month_count; ++month)<br />
std::cout &lt;&lt; arr_month[month] &lt;&lt; std::endl;;</p>
<p>std::cout &lt;&lt; &quot;Sort array!&quot; &lt;&lt; std::endl;<br />
std::sort(arr_month, arr_month + month_count);<br />
std::cout &lt;&lt; &quot;Array sorted!&quot; &lt;&lt; std::endl;</p>
<p>for (std::size_t month = 0; month &lt; month_count; ++month)<br />
std::cout &lt;&lt; arr_month[month] &lt;&lt; std::endl;<br />
}</p>
<p>liefert mir folgende ergebniss</p>
<p>ompilierung läuft...<br />
main.cpp<br />
C:\Dokumente und Einstellungen\All Users\Desktop\Auf5\main.cpp(34) : error C2039: 'size_t' : Ist kein Element von 'std'<br />
C:\Dokumente und Einstellungen\All Users\Desktop\Auf5\main.cpp(37) : error C2039: 'size_t' : Ist kein Element von 'std'<br />
C:\Dokumente und Einstellungen\All Users\Desktop\Auf5\main.cpp(44) : error C2039: 'size_t' : Ist kein Element von 'std'<br />
C:\Dokumente und Einstellungen\All Users\Desktop\Auf5\main.cpp(44) : error C2374: 'month' : Neudefinition; Mehrfachinitialisierung<br />
C:\Dokumente und Einstellungen\All Users\Desktop\Auf5\main.cpp(37) : Siehe Deklaration von 'month'<br />
C:\Dokumente und Einstellungen\All Users\Desktop\Auf5\main.cpp(46) : warning C4508: 'main' : Funktion sollte einen Wert zurueckgeben; Ergebnistyp 'void' angenommen<br />
Fehler beim Ausführen von cl.exe.</p>
<p>main.obj - 4 Fehler, 1 Warnung(en)</p>
<p>ich habe aber keine Idée <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283948</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283948</guid><dc:creator><![CDATA[afokam]]></dc:creator><pubDate>Sun, 13 May 2007 11:19:32 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 11:21:07 GMT]]></title><description><![CDATA[<p>Welcher Compiler ist das? Visual C++ 6.0?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283950</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283950</guid><dc:creator><![CDATA[Shinja]]></dc:creator><pubDate>Sun, 13 May 2007 11:21:07 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 11:24:08 GMT]]></title><description><![CDATA[<p>es ist 6.0</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283952</guid><dc:creator><![CDATA[afokam]]></dc:creator><pubDate>Sun, 13 May 2007 11:24:08 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 12:35:23 GMT]]></title><description><![CDATA[<p>Hmm dann pack Visual C++ 6.0 mal direkt in den Mülleimer und hol dir Visual C++ 2005 Express Edition. Der ist kostenlos und aktuell. Mein Code ist für gewöhnlich korrekt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1284002</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1284002</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sun, 13 May 2007 12:35:23 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Sun, 13 May 2007 12:51:07 GMT]]></title><description><![CDATA[<p>danke!<br />
mache ich! <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="😕"
    /> <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="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1284012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1284012</guid><dc:creator><![CDATA[afokam]]></dc:creator><pubDate>Sun, 13 May 2007 12:51:07 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Wed, 13 Jun 2007 22:12:42 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Wer sagt mir wo meinen Fehler Liegt?</p>
<p>#include&lt;iostream&gt;<br />
#include&lt;string&gt;<br />
using namespace std;</p>
<p>class Name<br />
{<br />
private:<br />
char vorname[20];<br />
char *ptrvorname;<br />
char nachname[20];<br />
char <em>ptrnachname;<br />
int laenge1,laenge2;<br />
public:<br />
void set_first(char</em>first)<br />
{<br />
cout&lt;&lt;&quot;\nVorname eingeben&quot; ;<br />
cin&gt;&gt;vorname;<br />
laenge1=strlen(vorname);<br />
for(int i=0;i&lt;laenge1;i++)<br />
cout&lt;&lt;&quot; &quot;&lt;&lt;vorname[i];<br />
<em>ptrvorname=vorname[i];<br />
ptrvorname=new char[strlen(first)+1];<br />
strcpy(vorname,first);<br />
}<br />
void set_last(char</em>last)<br />
{<br />
cout&lt;&lt;&quot;\nNachname eingeben :&quot;;<br />
cin&gt;&gt;nachname;<br />
laenge2=strlen(nachname);<br />
for(int i=0;i&lt;laenge2;i++)<br />
cout&lt;&lt;&quot; &quot;&lt;&lt;nachname[i];<br />
*ptrnachname=nachname[i];<br />
ptrnachname=new char[strlen(last)+1];<br />
strcpy(nachname,last);<br />
}<br />
char *geht_first(void)<br />
{<br />
return vorname;<br />
}</p>
<p>char *get_last(void)<br />
{<br />
return nachname;<br />
}</p>
<p>//int check();<br />
};</p>
<p>int main()<br />
{<br />
Name Student;<br />
Student.set_first(*first);<br />
Student.set_last(*last);<br />
}</p>
<p>Dass problem liegt schon bei meine Main funktion.</p>
<p>Ich will dieses Programm testen! :p</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1305259</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1305259</guid><dc:creator><![CDATA[afokam]]></dc:creator><pubDate>Wed, 13 Jun 2007 22:12:42 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Thu, 14 Jun 2007 05:48:46 GMT]]></title><description><![CDATA[<p>Wie wärs mal mit cpp-Tags? So beim überfliegen wüsst ich nicht woher <em>first</em> und <em>last</em> herkommen sollten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1305307</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1305307</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Thu, 14 Jun 2007 05:48:46 GMT</pubDate></item><item><title><![CDATA[Reply to String sortieren on Thu, 14 Jun 2007 07:04:35 GMT]]></title><description><![CDATA[<p>Und außerdem sind die set_first() und set_last() Methoden eine mittlere Katastrophe:</p>
<pre><code class="language-cpp">void set_first(char*first) 
{ 
  cout&lt;&lt;&quot;\nVorname eingeben&quot; ;
  cin&gt;&gt;vorname;
  laenge1=strlen(vorname); 
  for(int i=0;i&lt;laenge1;i++) 
    cout&lt;&lt;&quot; &quot;&lt;&lt;vorname[i];              //bis hierhin womöglich noch braucbar
  *ptrvorname=vorname[i];               //schreibt den Null-Terminator von Vorname irgendwohin (ptrvorname ist nicht initialisiert)
  ptrvorname=new char[strlen(first)+1]; //legt ein neues Array an (kein delete &gt; mögliches Speicherleck
  strcpy(vorname,first);                //füllt das Array mit Daten (woher kommen die?)
}
</code></pre>
<p>Und du solltest dich einigen, ob die Methoden den Namen selber einlesen oder als Parameter übernehmen - beides kombiniert macht idR wenig Sinn.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1305358</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1305358</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 14 Jun 2007 07:04:35 GMT</pubDate></item></channel></rss>