<?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[Weg finder]]></title><description><![CDATA[<p>Also ich habe vor einen Wegfinder für die Londoner U-Bahn zus schreiben, doch kenne ich mich nich wirklich mit Algorythmen aus. Deshalb meine Frage: wie sage ich dem Programm, dass es von Punkt a z.B 3 Möglichkeiten hatt, und dann entweder an punkt b,c oder d ankommt.???</p>
<p>MFG: LPP1991</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/185265/weg-finder</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 03:06:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/185265.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 23 Jun 2007 13:03:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 13:03:11 GMT]]></title><description><![CDATA[<p>Also ich habe vor einen Wegfinder für die Londoner U-Bahn zus schreiben, doch kenne ich mich nich wirklich mit Algorythmen aus. Deshalb meine Frage: wie sage ich dem Programm, dass es von Punkt a z.B 3 Möglichkeiten hatt, und dann entweder an punkt b,c oder d ankommt.???</p>
<p>MFG: LPP1991</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312133</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312133</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 13:03:11 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 13:10:56 GMT]]></title><description><![CDATA[<p>Du könntest das U-Bahn-Netz als Graph realisieren - je nach Größe entweder in Form einer Adjazenzliste (jeder Knoten speichert eine Liste seiner Nachfolger) oder Adjazenzmatrix (zweidimensionales bool-Array - in Feld (i,j) steht ein Eintrag, ob es eine Verbindung von j nach j gibt).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312136</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312136</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Sat, 23 Jun 2007 13:10:56 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 13:22:01 GMT]]></title><description><![CDATA[<p>So und wie sieht sowas dan als script aus? nur nen kleines Beispiel.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312146</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312146</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 13:22:01 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 13:30:20 GMT]]></title><description><![CDATA[<p>&quot;kurzes&quot; Beispiel wird schwierig - die Arbeit mit Graphen (und die dafür verfügbaren Algorithmen) füllt Bände. Versuch mal dein Glück unter Google oder Wikipedia.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312153</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312153</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Sat, 23 Jun 2007 13:30:20 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 13:36:28 GMT]]></title><description><![CDATA[<p>Also es sieht vielleicht verwirrend aus, doch wollte ich fragen, ob das so auch funktionieren kann. Nur zeigt das programm mir die Variable WEG nicht an, und daraus schließe ich dass er von Station a nicht weiter springt. wieso?</p>
<p>MFG: LPP1991</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;
char a,b,c,d,e,f,g,h;
char start;
int shortest;
int Ziel=0;
char station;
int weg;
int lol;
int station_a;
int station_b;
int station_c;
int station_d;
int station_e;
int station_f;
int station_g;
int station_h;

int main(int argc, char *argv[])
{
start=station_a;
Ziel=station_f;
station_h=4137;

while(Ziel==0)
{

if (station=a&amp;&amp;station_a!=1)
{
 station_a=1;
 switch(3)
 {
 case 1: station=b; weg++;
 case 2: station=c; weg++;
 case 3: station=d; weg++;

 if(station_a=4137)
        {
        Ziel=1;
        cout &lt;&lt; weg;
        }
 }
 break;
}

if (station=b&amp;&amp;station_b!=1)
 {
 station_b=1;
 switch(2)
 {
 case 1: station=g; weg++;
 case 2: station=a; weg++;

 if(station_b=4137)
        {
        Ziel=1;
        cout &lt;&lt; weg;
        }
 }
 break;
}

if (station=c&amp;&amp;station_c!=1)
 {
 station_c=1;
 switch(3)
 {
 case 1: station=h; weg++;
 case 2: station=a; weg++;
 case 3: station=f; weg++;

 if(station_c=4137)
        {
        Ziel=1;
        cout &lt;&lt; weg;
        }
 }
 break;
}

if (station=d&amp;&amp;station_d!=1)
 {
 station_d=1;
 switch(2)
 {
 case 1: station=f; weg++;
 case 2: station=a; weg++;

 if(station_d=4137)
        {
        Ziel=1;
        cout &lt;&lt; weg;
        }
 }
 break;
}

if (station=g&amp;&amp;station_g!=1)
 {
 station_g=1;
 switch(2)
 {
 case 1: station=b; weg++;
 case 2: station=h; weg++;

 if(station_g=4137)
        {
        Ziel=1;
        cout &lt;&lt; weg;
        }
 }
 break;
}

if (station=g&amp;&amp;station_g!=1)
 {
 station_g=1;
 switch(2)
 {
 case 1: station=b; weg++;
 case 2: station=h; weg++;

 if(station_g=4137)
        {
        Ziel=1;
        cout &lt;&lt; weg;
        }
 }
 break;
}

if (station=h&amp;&amp;station_h!=1)
 {
 station_h=1;
 switch(2)
 {
 case 1: station=g; weg++;
 case 2: station=c; weg++;

 if(station_h=4137)
        {
        Ziel=1;
        cout &lt;&lt; weg;
        }
 }
 break;
}

if (station=f&amp;&amp;station_f!=1)
 {
 station_f=1;
 switch(2)
 {
 case 1: station=c; weg++;
 case 2: station=d; weg++;

 if(station_f=4137)
        {
        Ziel=1;
        cout &lt;&lt; weg;
        }
 }
 break;
}
}

cin&gt;&gt;lol;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1312159</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312159</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 13:36:28 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 13:39:42 GMT]]></title><description><![CDATA[<p>Das Ding sieht ja grausam aus.</p>
<p>(das geht los bei einer fehlenden Struktur und hört bei solchen Nonsens-Anweisungen wie &quot;switch(3)&quot; noch lange nicht auf)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312162</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312162</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Sat, 23 Jun 2007 13:39:42 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 13:43:16 GMT]]></title><description><![CDATA[<p>Grob gesagt für das 2. genannte (wenn ich das richtig in erinnerung habe):<br />
du nummerierst all deine Knotenpunkte (Bahnhöfe)<br />
Du legst ein 2-dimensionales bool array an (können auch vectoren sein), &quot;quadratisch&quot;<br />
(also wenn du 12 Knotenpunkte hast bool wege[12][12] o.ä.)</p>
<p>Wenn es jetzt von 3 auf 7 ne Verbindung gibt setzt du wege[5][7] auf true. Wenn der Rückweg auch geht wege[7][5] ebenfalls.</p>
<p>Wann immer du an einem Bahnhof ankommst(z.B Bahnhof <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f60e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--smiling_face_with_sunglasses"
      title="8)"
      alt="😎"
    /> durchläufst du einfach wege[8]</p>
<pre><code class="language-cpp">for(size_t i=0;i&lt;12;++i) //die 12 durch die Variable ersetzen wo die Anzahl der BahnhLfe drinsteht
    if(wege[8][i])
        cout&lt;&lt;&quot;Es gibt einen Weg von 8 nach &quot;&lt;&lt;i&lt;&lt;endl;
    else
        cout&lt;&lt;&quot;Es gibt keinen Weg von 8 nach &quot;&lt;&lt;i&lt;&lt;endl;
</code></pre>
<p>Sowas in der Art halt. Aber Google und Wikipedia sind hier denke ich wirklich deine besten Freunde.</p>
<p>EDIT: hier sind 2 Posts dazwischengeflogen, jetzt würd ich eher sagen: such dir ein Grundlagentutorial. if(station=a) u.ä. sollte man besser nicht schreiben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312163</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312163</guid><dc:creator><![CDATA[Shinja]]></dc:creator><pubDate>Sat, 23 Jun 2007 13:43:16 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 13:42:12 GMT]]></title><description><![CDATA[<p>Hmm, ich vermute mal, bei Deinem Kenntnisstand ist ein Wegfinde-Algorithmus noch nicht wirklich denkbar. Versuch erst mal, die Basics der Sprache C++ zu lernen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312164</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312164</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Sat, 23 Jun 2007 13:42:12 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 14:48:46 GMT]]></title><description><![CDATA[<p>Also ich möchte nur mal eines loswerden.<br />
1.Ich bin erst 16!<br />
2.Ich hab &quot;KEIN&quot; Mathe-Info in der Schule (Weil der Kurs nicht zu stande kam)<br />
3.Ich hab mit HTML angefangen, dann WDL, dann Grundlagen von C und ann Grundlagen von C++, und ein wenig von WinAPI!!!</p>
<p>Also bitte nicht meckern. Geht das theoretisch denn mit switch und case?</p>
<p>MFG: LPP1991</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312200</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312200</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 14:48:46 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 14:55:25 GMT]]></title><description><![CDATA[<p>theoretisch schon, aber es ist nicht empfehlenswert.</p>
<p>du willst einen weg finden, also einen weg vom start zum ziel suchen. eine recht einfache variante dafür ist breitensuche. <a href="http://de.wikipedia.org/wiki/Breitensuche" rel="nofollow">http://de.wikipedia.org/wiki/Breitensuche</a></p>
<p>nicht von den ganzen begriffen irritieren lassen. der abschnitt &quot;Algorithmus (informell)&quot; liefert eigentlich genug info.</p>
<p>und dann empfehle ich dir mal die ersten paar lektionen von dem tutorial hier anzugucken: <a href="http://www.volkard.de/vcppkold/inhalt.html" rel="nofollow">http://www.volkard.de/vcppkold/inhalt.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312205</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312205</guid><dc:creator><![CDATA[thordk]]></dc:creator><pubDate>Sat, 23 Jun 2007 14:55:25 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 15:02:54 GMT]]></title><description><![CDATA[<p>Ok, vielen Dank! Meine Variante funktioniert tatsächlich, doch wie sage ich dem Programmd dass der alle Wege verschieden speichern soll? Also weg 1 führt über b ung nach H, weg 2 führt über c nach H und weg 3 führt über d nach f zu H. Sodass ich sie vergleichen kann und das programm dann sagt welcher Weg der kürzeste ist? Also mommentan spucjt das Programm einfach den Weg 1 aus, da er immer aus den Case 1 besteht. Jedoch ist Weg 2 halt kürzer. Wie mach ich dass?</p>
<p>LPP1991</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312210</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312210</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 15:02:54 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 15:05:15 GMT]]></title><description><![CDATA[<p>finde alle wege und such davon den kürzesten aus <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312215</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312215</guid><dc:creator><![CDATA[thordk]]></dc:creator><pubDate>Sat, 23 Jun 2007 15:05:15 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 15:08:13 GMT]]></title><description><![CDATA[<p>LPP1991 schrieb:</p>
<blockquote>
<p>Also bitte nicht meckern.</p>
</blockquote>
<p>Niemand meckert. Wir alle haben mal klein angefangen. Wir haben nur versucht, eine realistische Einschätzung Deines Kenntnissstands vorzunehmen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312219</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312219</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Sat, 23 Jun 2007 15:08:13 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 15:09:03 GMT]]></title><description><![CDATA[<p><a href="http://www-i1.informatik.rwth-aachen.de/~algorithmus/algo7.php" rel="nofollow">http://www-i1.informatik.rwth-aachen.de/~algorithmus/algo7.php</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312222</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312222</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Sat, 23 Jun 2007 15:09:03 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 15:09:27 GMT]]></title><description><![CDATA[<p>Ja, aber er nimmt immer die Case1'er und die anderen findet der garnicht. Wieso? und wenn ich case3 wegnehme, kommt 2 raus, aber wenn ich case1 oder 2 wegnehme immer noch 3.. das ist komisch. Warum?</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;
char start;
int shortest;
int Ziel=0;
char *station;
int weg=0;
int lol;
int station_a=0;
int station_b=0;
int station_c=0;
int station_d=0;
int station_e=0;
int station_f=0;
int station_g=0;
int station_h=0;

int main(int argc, char *argv[])
{
station_h=4137;
station=&quot;a&quot;;

while(Ziel==0)
{
/////////////////////////////////////////////////////////////////////////////////
if (station=&quot;a&quot;)
 {
 if(station_a==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_a=1;
 switch(3)
 {
 case 1: if(station_b!=1){station=&quot;b&quot;; weg++; break;}
 case 2: if(station_c!=1){station=&quot;c&quot;; weg++; break;}
 case 3: if(station_d!=1){station=&quot;d&quot;; weg++; break;}
 }
}
/////////////////////////////////////////////////////////////////////////////////
if (station=&quot;b&quot;)
 {
 if(station_b==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_b=1;
 switch(2)
 {
 case 1: if(station_g!=1){station=&quot;g&quot;; weg++; break;}
 case 2: if(station_a!=1){station=&quot;a&quot;; weg++; break;}
 }
}
/////////////////////////////////////////////////////////////////////////////////
if (station=&quot;c&quot;)
 {
 if(station_c==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_c=1;
 switch(3)
 {
 case 1: if(station_h!=1){station=&quot;h&quot;; weg++; break;}
 case 2: if(station_a!=1){station=&quot;a&quot;; weg++; break;}
 case 3: if(station_f!=1){station=&quot;f&quot;; weg++; break;}
 }
}
/////////////////////////////////////////////////////////////////////////////////
if (station=&quot;d&quot;)
 {
 if(station_d==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_d=1;
 switch(2)
 {
 case 1: if(station_f!=1){station=&quot;f&quot;; weg++; break;}
 case 2: if(station_a!=1){station=&quot;a&quot;; weg++; break;}
 }
}
/////////////////////////////////////////////////////////////////////////////////
if (station=&quot;g&quot;)
 {
 if(station_g==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_g=1;
 switch(2)
 {
 case 1: if(station_b!=1){station=&quot;b&quot;; weg++; break;}
 case 2: if(station_h!=1){station=&quot;h&quot;; weg++; break;}
 }
}
/////////////////////////////////////////////////////////////////////////////////
if (station=&quot;h&quot;)
 {
 if(station_h==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_h=1;
 switch(2)
 {
 case 1: if(station_g!=1){station=&quot;g&quot;; weg++; break;}
 case 2: if(station_c!=1){station=&quot;c&quot;; weg++; break;}
 }
}
/////////////////////////////////////////////////////////////////////////////////
if (station=&quot;f&quot;)
 {
 if(station_f==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_f=1;
 switch(2)
 {
 case 1: if(station_c!=1){station=&quot;c&quot;; weg++; break;}
 case 2: if(station_d!=1){station=&quot;d&quot;; weg++; break;}
 }
}

}

cin&gt;&gt;lol;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1312223</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312223</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 15:09:27 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 15:21:14 GMT]]></title><description><![CDATA[<p>station=&quot;f&quot;</p>
<p>sowas ist eine zuweisung. das ist zwar gültig in einem if-statement, leistet aber wahrscheinlich nicht, was du willst. dei zuweisung liefert nämlich den wert der variablen nach der zuweisung zurück. da dieser ungleich 0 ist, interpretiert c++ das als &quot;true&quot;.</p>
<p>da station ein cstring ist, musst du auch die entsprechende methode zum vergleichen von cstrings verwenden. <a href="http://cppreference.com/stdstring/strncmp.html" rel="nofollow">http://cppreference.com/stdstring/strncmp.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312239</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312239</guid><dc:creator><![CDATA[thordk]]></dc:creator><pubDate>Sat, 23 Jun 2007 15:21:14 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 15:24:39 GMT]]></title><description><![CDATA[<p>Weil switch nunmal nicht so funktionniert.</p>
<p>An switch übergibst du eine Variable, keine Zahl.</p>
<p>Und es ist nicht so, dass einer meckert. Es ist nur halt so, dass in dem Code recht viele Fehler stecken, was darauf schlieszen lässt dass du erst vor kurzem mit C++ angefangen hast. Daher empfiehlt man dir auch dich einmal durch ein Tutorial zu lesen (gibt ja genug im Internet, sollte auch hier einige Links geben) Danach kannst du einen groszen teil deiner Fehler selbst beheben. Wegfindung scheint halt ganz einfach noch (im Augenblick) etwas zu schwer für deinen Kenntnisstand zu sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312243</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312243</guid><dc:creator><![CDATA[Shinja]]></dc:creator><pubDate>Sat, 23 Jun 2007 15:24:39 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 15:35:16 GMT]]></title><description><![CDATA[<p>Also, Danke! Hab ich total vergessen, ist aber klar, doch hab ich dadurch einen Fehler bekommen, Ich habe versucht, und versucht, aber der Fehler bleibt. Also hier erstmal der COde nun:</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;string.h&gt;

using namespace std;

char start;
int shortest;
int Ziel=0;
string station[100];
int weg=0;
int lol;
int station_a=0;
int station_b=0;
int station_c=0;
int station_d=0;
int station_e=0;
int station_f=0;
int station_g=0;
int station_h=0;

int main(int argc, char *argv[])
{
station_h=4137;
string station=&quot;a&quot;;

while(Ziel==0)
{
/////////////////////////////////////////////////////////////////////////////////
if( strcmp( station, &quot;a&quot; ) == 0 )
 {
 if(station_a==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_a=1;
 switch(3)
 {
 case 1: if(station_b!=1){station=&quot;b&quot;; weg++; break;}
 case 2: if(station_c!=1){station=&quot;c&quot;; weg++; break;}
 case 3: if(station_d!=1){station=&quot;d&quot;; weg++; break;}
 }
}
</code></pre>
<p><strong>usw...</strong></p>
<p>nun der Fehler:</p>
<pre><code>C:\Dev-Cpp\Projects\LUB\main.cpp In function `int main(int, char**)': 

C:\Dev-Cpp\Projects\LUB\main.cpp no matching function for call to `strncmp(std::string&amp;, const char[2])' 

C:\Dev-Cpp\include\string.h:51 candidates are: int strncmp(const char*, const char*, size_t)
</code></pre>
<p>also was ist los? Ich versteh den Fehler nich. Egal ob ich Station als string oder char nehme.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312248</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312248</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 15:35:16 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 15:39:29 GMT]]></title><description><![CDATA[<p>strncmp erwartet drei parameter. sagt dir der compiler ja auch. als dritten parameter erwartet es die anzahl der zeichen, die verglichen werden sollen.</p>
<p>vielleicht ist es für dich empfehlenswert, gleich komplett auf std::string umzusteigen. für die kannst du nämlich einfach == verwenden.</p>
<pre><code class="language-cpp">string station[100];
</code></pre>
<p>das definiert übrigens einen array von string mit 100 elementen und keinen string mit 100 zeichen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312252</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312252</guid><dc:creator><![CDATA[thordk]]></dc:creator><pubDate>Sat, 23 Jun 2007 15:39:29 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 15:47:46 GMT]]></title><description><![CDATA[<p>Also, ich hab es vertsnaden, doch mal eine Frage, wie müsste ich es machen um den User einen Namen einzugeben, und den zu vergleichen. Ich hab das letztenms noch I-Wo gebraucht, doch finde ich die Datei leider nich mehr wo das stand!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312259</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312259</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 15:47:46 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 16:14:18 GMT]]></title><description><![CDATA[<p>Also ich habs gefunden und mal so gemacht wie ich denke. Aber wenn ich nun als User &quot;a&quot; eintippe macht das Programm nicht mehr weiter. Und da ich station_h als Ziel gesetzt habe (Durch die Nr. 4137) müsste er mir eigentlich eine &quot;1&quot; anzeigen, da ja von &quot;a&quot; weg++; ausgeführt wird. Doch auch dass passiert nicht. Hier der Code:</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;string.h&gt;

using namespace std;

char start;
int shortest;
int Ziel=0;
int weg=0;
int lol;
int station_a=0;
int station_b=0;
int station_c=0;
int station_d=0;
int station_e=0;
int station_f=0;
int station_g=0;
int station_h=0;
string a= &quot;a&quot;;
string b= &quot;b&quot;;
string c= &quot;c&quot;;
string d= &quot;d&quot;;

int main(int argc, char *argv[])
{
station_b=4137;
string station;
getline(cin, station);

while(Ziel==0)
{
/////////////////////////////////////////////////////////////////////////////////

if( station.compare(&quot;a&quot;) == 1 )
 {
 if(station_a==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_a=1;
 switch(3)
 {
 case 1: if(station_b!=1){station.erase(); station.append(B); weg++; break;}
 case 2: if(station_c!=1){station.erase(); station.append(c); weg++; break;}
 case 3: if(station_d!=1){station.erase(); station.append(d); weg++; break;}
 }
}
</code></pre>
<p>usw...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312275</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 16:14:18 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 16:16:24 GMT]]></title><description><![CDATA[<p>switch(3) ist absoluter Unfug! (Warum wurde bereits erklärt)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312279</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312279</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Sat, 23 Jun 2007 16:16:24 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 16:19:06 GMT]]></title><description><![CDATA[<p>Weil switch immer noch nicht so funktionniert. Versuch es mal mit switch(station_a)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312282</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312282</guid><dc:creator><![CDATA[Shinja]]></dc:creator><pubDate>Sat, 23 Jun 2007 16:19:06 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 16:22:53 GMT]]></title><description><![CDATA[<p>Also ich habe alle switch() mit Switch(station_&quot;buchstabe&quot;) ersetzt. Doch funktioniert es immer noch nicht, er springt immer noch nicht weiter.<br />
warum?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312285</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312285</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 16:22:53 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 16:47:14 GMT]]></title><description><![CDATA[<p>Also hier der Code. Es kommen zwar komische ergebnisse raus so wie 8,7,1,0 und so, scheint aber zu funktionieren, doch wenn ich z.B. B als Ziel setze, und der User &quot;d&quot; als startpunkt eintippt, scheint es wieder nicht zu funktionieren, da ich dann kein Ergebnmis erhalte. und noch was, Woher kommt die Zahl 8 etc.?? und wie kann ich dem jetzt sagen der soll alle Wege finden und schaun wo der kürzeste lang geht? Müsste danit doch auch gehen oder?</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;string.h&gt;

using namespace std;

char start;
int shortest;
int Ziel=0;
int weg=0;
int lol;
int station_a=0;
int station_b=0;
int station_c=0;
int station_d=0;
int station_e=0;
int station_f=0;
int station_g=0;
int station_h=0;
string a= &quot;a&quot;;
string b= &quot;b&quot;;
string c= &quot;c&quot;;
string d= &quot;d&quot;;
string f= &quot;f&quot;;
string g= &quot;g&quot;;
string h= &quot;h&quot;;

int main(int argc, char *argv[])
{
station_h=4137;
string station;
getline(cin, station);

while(Ziel==0)
{
/////////////////////////////////////////////////////////////////////////////////

if( station.compare(&quot;a&quot;) == 0)
 {
 if(station_a==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_a=1;
 switch(station_a)
 {
 case 1: if(station_b!=1){station.erase(); station.append(b); weg++; }
 case 2: if(station_c!=1){station.erase(); station.append(c); weg++; }
 case 3: if(station_d!=1){station.erase(); station.append(d); weg++; }
 }
}
/////////////////////////////////////////////////////////////////////////////////
if( station.compare(&quot;b&quot;) == 0)
 {
 if(station_b==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_b=1;
 switch(station_b)
 {
 case 1: if(station_g!=1){station.erase(); station.append(g); weg++; }
 case 2: if(station_a!=1){station.erase(); station.append(a); weg++; }
 }
}
/////////////////////////////////////////////////////////////////////////////////
if( station.compare(&quot;c&quot;) == 0)
 {
 if(station_c==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_c=1;
 switch(station_c)
 {
 case 1: if(station_h!=1){station.erase(); station.append(h); weg++; }
 case 2: if(station_a!=1){station.erase(); station.append(a); weg++; }
 case 3: if(station_f!=1){station.erase(); station.append(f); weg++; }
 }
}
/////////////////////////////////////////////////////////////////////////////////
if( station.compare(&quot;d&quot;) == 0)
 {
 if(station_d==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_d=1;
 switch(station_d)
 {
 case 1: if(station_f!=1){station.erase(); station.append(f); weg++; }
 case 2: if(station_a!=1){station.erase(); station.append(a); weg++; }
 }
}
/////////////////////////////////////////////////////////////////////////////////
if( station.compare(&quot;g&quot;) == 0)
 {
 if(station_g==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_g=1;
 switch(station_g)
 {
 case 1: if(station_b!=1){station.erase(); station.append(b); weg++; }
 case 2: if(station_h!=1){station.erase(); station.append(h); weg++; }
 }
}
/////////////////////////////////////////////////////////////////////////////////
if( station.compare(&quot;h&quot;) == 0)
 {
 if(station_h==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_h=1;
 switch(station_h)
 {
 case 1: if(station_g!=1){station.erase(); station.append(g); weg++; }
 case 2: if(station_c!=1){station.erase(); station.append(c); weg++; }
 }
}
/////////////////////////////////////////////////////////////////////////////////
if( station.compare(&quot;f&quot;) == 0)
 {
 if(station_f==4137)
        {
        cout &lt;&lt; weg;
        Ziel=1;
        }

 station_f=1;
 switch(station_f)
 {
 case 1: if(station_c!=1){station.erase(); station.append(c); weg++; }
 case 2: if(station_d!=1){station.erase(); station.append(d); weg++; }
 }
}

}

cin&gt;&gt;lol;
}
</code></pre>
<p>MFG: LPP1991</p>
<p>PS. Danke dass ihr eure zeit opfert mir zu helfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312295</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 16:47:14 GMT</pubDate></item><item><title><![CDATA[Reply to Weg finder on Sat, 23 Jun 2007 16:58:30 GMT]]></title><description><![CDATA[<p>Hier meine Skizze:</p>
<p>b------g\<br />
| \<br />
| h<br />
| /<br />
a------c/<br />
| |<br />
| |<br />
| |<br />
d------f</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312307</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312307</guid><dc:creator><![CDATA[LPP1991]]></dc:creator><pubDate>Sat, 23 Jun 2007 16:58:30 GMT</pubDate></item></channel></rss>