<?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[Probleme bei function overloading]]></title><description><![CDATA[<p>Hallo. Ich habe große Probleme bei einer Aufgabe. Wäre schön wenn mir jemand beim Lösungsansatz hilft.</p>
<p>Deklarieren und definieren Sie mittels &quot;function overloading&quot; zwei Prozeduren die in einem Feld einen Wert suchen, und den Index des gefundenen Wertes zurückgeben. Index ist –1, falls der Wert im Feld nicht vorhanden ist. Die Felder enthalten Werte vom Typ int und C-Zeichenketten.<br />
Feld v1 mit den Elementen 3,2,0,2,-10 und Feld v2 mit den Elementen &quot;abc1&quot;,&quot;ab2&quot;,&quot;abcd3&quot;,&quot;abx4&quot;,&quot;yxc5&quot;;a2).</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/121644/probleme-bei-function-overloading</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 21:52:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/121644.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Sep 2005 10:01:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme bei function overloading on Mon, 26 Sep 2005 10:01:28 GMT]]></title><description><![CDATA[<p>Hallo. Ich habe große Probleme bei einer Aufgabe. Wäre schön wenn mir jemand beim Lösungsansatz hilft.</p>
<p>Deklarieren und definieren Sie mittels &quot;function overloading&quot; zwei Prozeduren die in einem Feld einen Wert suchen, und den Index des gefundenen Wertes zurückgeben. Index ist –1, falls der Wert im Feld nicht vorhanden ist. Die Felder enthalten Werte vom Typ int und C-Zeichenketten.<br />
Feld v1 mit den Elementen 3,2,0,2,-10 und Feld v2 mit den Elementen &quot;abc1&quot;,&quot;ab2&quot;,&quot;abcd3&quot;,&quot;abx4&quot;,&quot;yxc5&quot;;a2).</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880282</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880282</guid><dc:creator><![CDATA[Janine]]></dc:creator><pubDate>Mon, 26 Sep 2005 10:01:28 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Mon, 26 Sep 2005 10:12:31 GMT]]></title><description><![CDATA[<p>Hausaufgaben werden hier eigentlich nicht gemacht...<br />
Zeig mal, was du schon gemacht hast, dann wird dir auch geholfen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880289</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880289</guid><dc:creator><![CDATA[Maxi]]></dc:creator><pubDate>Mon, 26 Sep 2005 10:12:31 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Mon, 26 Sep 2005 10:21:39 GMT]]></title><description><![CDATA[<pre><code>find(char wert,int index, char feld)
{
while(int index=0, index++)
if wert==feld;
return wert
else return -1;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/880293</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880293</guid><dc:creator><![CDATA[Janine]]></dc:creator><pubDate>Mon, 26 Sep 2005 10:21:39 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Mon, 26 Sep 2005 10:33:55 GMT]]></title><description><![CDATA[<p>Janine schrieb:</p>
<blockquote>
<pre><code>find(char wert,int index, char feld)
{
while(int index=0, index++)
if wert==feld;
return wert
else return -1;
}
</code></pre>
</blockquote>
<p>Die Aufgabe ist zu hoch für dich, ehrlich. Mach ein Tutorial.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880307</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880307</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Mon, 26 Sep 2005 10:33:55 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Mon, 26 Sep 2005 10:35:39 GMT]]></title><description><![CDATA[<p>Danke für die tolle Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880309</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880309</guid><dc:creator><![CDATA[Janine]]></dc:creator><pubDate>Mon, 26 Sep 2005 10:35:39 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Mon, 26 Sep 2005 10:36:51 GMT]]></title><description><![CDATA[<p>Janine schrieb:</p>
<blockquote>
<p>Danke für die tolle Hilfe!</p>
</blockquote>
<p>Nicht wahr? Mit einer Komplettlösung wäre dir nicht geholfen, die würdest du abschreiben, ohne sie zu verstehen. So lernst du's. <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/880310</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880310</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Mon, 26 Sep 2005 10:36:51 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Mon, 26 Sep 2005 10:42:04 GMT]]></title><description><![CDATA[<p>Hi Janine,</p>
<p>so ganz unrecht hat MFK ja nicht. Wenn du versuchst dein Programm zu kompilieren,<br />
dann wirst du ja feststellen, dass da noch einiges 'unschön' ist.<br />
Also schreib doch erstmal eine deiner beiden Funktionen mit leerem<br />
Rumpf und zwar<br />
- syntaktisch korrekt<br />
- korrekte Parameter + Rückgabewert<br />
- korrekt aufrufbar</p>
<p>Dann sehen wir weiter.</p>
<p>Jockel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880314</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880314</guid><dc:creator><![CDATA[Jockelx]]></dc:creator><pubDate>Mon, 26 Sep 2005 10:42:04 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Mon, 26 Sep 2005 12:35:58 GMT]]></title><description><![CDATA[<p>au weia <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /> das sieht düster aus...</p>
<p>na ja, will mal nicht so sein <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>
<p>hier die funktion für das suchen im int-array. die such-funktion für string-arrays mußt du aber selber machen.</p>
<pre><code class="language-cpp">int
finde (int *array, int array_laenge, int zu_findende_zahl)
{
  for(int i=0; i&lt;array_laenge; i++) // alle felder des arrays durchlaufen
    if(array[i]==zu_findende_zahl)  // wenn das feld die gesuchte zahl enthält
      return i;                     // dann den index des feldes zurückgeben

  return -1;                        // -1, falls die zahl nicht gefunden wurde
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/880398</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880398</guid><dc:creator><![CDATA[Konfusius]]></dc:creator><pubDate>Mon, 26 Sep 2005 12:35:58 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Tue, 27 Sep 2005 08:25:27 GMT]]></title><description><![CDATA[<p>Danke!<br />
Ich hab mich hingesetzt und gegrübelt und das ist rausgekommen:</p>
<pre><code>int find(const int* feld, int wert, int size) {
  for(int index =0; index &lt; size; ++index) {
    if(feld[index] == wert) {
      return index;
    }
  }
  return -1;
}

int find(char* feld[], char wert[], int size) {
  for(int index =0; index &lt; size ; ++index) {
    if(feld[index] == wert) {
      return index;
    }
  }
  return -1;
}
</code></pre>
<p>Blos die Funktion für das char Feld funktioniert nicht. Ich komm nicht drauf warum. kann mir da jemand helfen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/881054</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/881054</guid><dc:creator><![CDATA[Janine]]></dc:creator><pubDate>Tue, 27 Sep 2005 08:25:27 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Tue, 27 Sep 2005 10:01:55 GMT]]></title><description><![CDATA[<p>Janine schrieb:</p>
<blockquote>
<p>Blos die Funktion für das char Feld funktioniert nicht. Ich komm nicht drauf warum. kann mir da jemand helfen</p>
</blockquote>
<p>Du vergleichst in deiner Funktion nur Pointer. Verwende strcmp().<br />
Kurt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/881136</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/881136</guid><dc:creator><![CDATA[ZuK]]></dc:creator><pubDate>Tue, 27 Sep 2005 10:01:55 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Wed, 28 Sep 2005 12:41:52 GMT]]></title><description><![CDATA[<p>Die Rede war am Anfang von Prozeduren,also vergesst das mal ganz schnell mit</p>
<pre><code>int find
</code></pre>
<p>Prozedur fängt mit void an und hat keinen Rückgabewert! Sähe dann so aus.</p>
<pre><code>void find(const int* feld, int wert, int size,int anzahl) {
  for(int index =0; index &lt; size; ++index)
    {
    if(feld[index] == wert)  {
      cout&lt;&lt;&quot;\nIndex der Zahl ist: &quot; &lt;&lt;index ;
      cout&lt;&lt;&quot;\nAnzahl der Zahl ist: &quot;&lt;&lt;anzahl&lt;&lt;endl&lt;&lt;endl; return ;
     }
   }
  cout&lt;&lt; &quot;\nIndex der Zahl ist: -1&quot;;
}
</code></pre>
<p>Für Feld von Zeichenketten weis ich au net so recht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882092</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882092</guid><dc:creator><![CDATA[Nightmare]]></dc:creator><pubDate>Wed, 28 Sep 2005 12:41:52 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Wed, 28 Sep 2005 12:58:14 GMT]]></title><description><![CDATA[<p>Ich krieg das nicht hin mit dem String Feld. Kann mir jemand helfen bitte</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882102</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882102</guid><dc:creator><![CDATA[Janine]]></dc:creator><pubDate>Wed, 28 Sep 2005 12:58:14 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Wed, 28 Sep 2005 13:02:23 GMT]]></title><description><![CDATA[<p>Wie gesagt verwende strcmp()</p>
<pre><code class="language-cpp">int find(char* feld[], char wert[], int size) { 
  for(int index =0; index &lt; size ; ++index) { 
    if( strcmp(feld[index], wert) == 0 ) { 
      return index; 
    } 
  } 
  return -1; 
}
</code></pre>
<p>Kurt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882104</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882104</guid><dc:creator><![CDATA[ZuK]]></dc:creator><pubDate>Wed, 28 Sep 2005 13:02:23 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Wed, 28 Sep 2005 13:13:51 GMT]]></title><description><![CDATA[<p>Hast du die strcmp mal angeschaut?<br />
Ansonsten ersetze</p>
<pre><code class="language-cpp">if(feld[index] == wert)
</code></pre>
<p>in deiner Funktion mal durch</p>
<pre><code class="language-cpp">if(strcmp(feld[index],wert) == 0)
</code></pre>
<p>[edit]Zu spät.[edit]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882106</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882106</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 28 Sep 2005 13:13:51 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Wed, 28 Sep 2005 13:07:59 GMT]]></title><description><![CDATA[<p>Und da du ja noch neu bist und die Sache vielleicht nicht<br />
richtig beurteilen kannst, gib ich dir noch den Tip<br />
Nightmare's Post zu ignorieren.</p>
<p>Nur weil irdendwo das Wort 'Prozedur' gefallen ist, muss man ja<br />
jetzt keinen unsinnigen Code schreiben.</p>
<p>Jockel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882111</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882111</guid><dc:creator><![CDATA[Jockelx]]></dc:creator><pubDate>Wed, 28 Sep 2005 13:07:59 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Wed, 28 Sep 2005 13:12:50 GMT]]></title><description><![CDATA[<p>Er ist wahrscheinlich von Pascal hierher gewechselt. <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/882116</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882116</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 28 Sep 2005 13:12:50 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Thu, 29 Sep 2005 08:33:48 GMT]]></title><description><![CDATA[<p>Danke ihr habt mir sehr geholfen. Es gibt nur ein kleines Problem bei der Funktion. Wenn zwei gleiche Zahlen vorkommen gibt er nur den Index der ersten aus und nicht alle. Ich hatte versucht das Feld mit einer for-Schleife von hinten noch durchlaufen zu lassen aber das funktioniert nicht. Hat einer von euch eine Idee?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882719</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882719</guid><dc:creator><![CDATA[Janine]]></dc:creator><pubDate>Thu, 29 Sep 2005 08:33:48 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Thu, 29 Sep 2005 08:39:44 GMT]]></title><description><![CDATA[<p>vielleicht ain array für die positionen anlegen!</p>
<p>Also wenn er eins findet, nicht gleich die position ausgeben, sondern diese in einem array speichern, und weitersuchen lassen, und wenn er noch eine findet, dann auch im array speichern!</p>
<p>Am ende dann das array ausgeben.</p>
<p>Hmm...weis nur nicht,wie weit du das jetzt verstehst oder umsetzen kannst!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882724</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882724</guid><dc:creator><![CDATA[ser1al]]></dc:creator><pubDate>Thu, 29 Sep 2005 08:39:44 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Thu, 29 Sep 2005 08:44:08 GMT]]></title><description><![CDATA[<p>theoretisch versteh ichs. aber wie ich das umsetz weis ich nich recht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882731</guid><dc:creator><![CDATA[Janine]]></dc:creator><pubDate>Thu, 29 Sep 2005 08:44:08 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Thu, 29 Sep 2005 08:44:46 GMT]]></title><description><![CDATA[<p>Janine schrieb:</p>
<blockquote>
<p>Es gibt nur ein kleines Problem bei der Funktion. Wenn zwei gleiche Zahlen vorkommen gibt er nur den Index der ersten aus und nicht alle.</p>
</blockquote>
<p>Ist das wirklich ein Problem im Sinne der Aufgabenstellung? Die Vorgabe war doch, <em>den Index</em> (Einzahl) zurückzugeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882732</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882732</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Thu, 29 Sep 2005 08:44:46 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Thu, 29 Sep 2005 08:56:33 GMT]]></title><description><![CDATA[<p>aber im int-Feld kommt die Zahl &quot;2&quot; zweimal vor. wenn ich die z.B. suche gibt er mir nur den Index der ersten. Wie müsste sie aussehen wenn ich egal wieviel gleiche Zahlen hab und deren Indices ausgeben lassen will.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882741</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882741</guid><dc:creator><![CDATA[Janine]]></dc:creator><pubDate>Thu, 29 Sep 2005 08:56:33 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Thu, 29 Sep 2005 09:03:44 GMT]]></title><description><![CDATA[<p>also ich hab mal eins gebastelt (nicht in der ide, weil ich hier keine habe. ES KANN ALSO SEIN, DAS EINIGES FEHLT ODER FEHLERHAFT IST)</p>
<pre><code class="language-cpp">int* find(int* array,int size,int number,int &amp;found)
{
 int *returnit;
 for(int i=0;i&lt;size;i++)
 {
  if(array[i]==number)
  {
   returnit[found]=i;
   found++;
  }
  else{}
 }
 return returnit;
}

int main(int argc, char* argv[])
{
 int test[5];
 int found=0;
 test[0]=1;
 test[1]=2;
 test[2]=3;
 test[3]=2;
 test[4]=2;

 int *result=find(test,5,2,found);
 for(int i=0;i&lt;found;i++)
  cout&lt;&lt;result[i]&lt;&lt;endl;
 getch();
        return 0;
}
</code></pre>
<p>Das soll nur zeigen, wie ich es gemeint habe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882748</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882748</guid><dc:creator><![CDATA[ser1al]]></dc:creator><pubDate>Thu, 29 Sep 2005 09:03:44 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Thu, 29 Sep 2005 09:06:23 GMT]]></title><description><![CDATA[<p>Vielleicht solltest du für returnit auch mal Speicher vereinbaren. Und was soll dieser else Zweig?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882751</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882751</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 29 Sep 2005 09:06:23 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Thu, 29 Sep 2005 09:07:42 GMT]]></title><description><![CDATA[<p>Braunstein schrieb:</p>
<blockquote>
<p>Vielleicht solltest du für returnit auch mal Speicher vereinbaren. Und was soll dieser else Zweig?</p>
</blockquote>
<p>yupp hast recht, wie gesagt, ich hab hier nix zum programmieren!<br />
War nur so ausm gedanken!</p>
<p>Wobei ich ehrlich sein muss, das ich das mit dem if-abfackeln irgendwie immer mach <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>
]]></description><link>https://www.c-plusplus.net/forum/post/882752</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882752</guid><dc:creator><![CDATA[ser1al]]></dc:creator><pubDate>Thu, 29 Sep 2005 09:07:42 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Thu, 29 Sep 2005 09:10:53 GMT]]></title><description><![CDATA[<p>vector anstelle eines int* wäre hier besser.<br />
Ich stimme aber MFK zu, dass in der ursprünglichen Aufgabenstellung nichts davon steht alle Indizes zu finden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882754</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882754</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 29 Sep 2005 09:10:53 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei function overloading on Thu, 29 Sep 2005 09:13:38 GMT]]></title><description><![CDATA[<p>Braunstein schrieb:</p>
<blockquote>
<p>vector anstelle eines int* wäre hier besser.<br />
Ich stimme aber MFK zu, dass in der ursprünglichen Aufgabenstellung nichts davon steht alle Indizes zu finden.</p>
</blockquote>
<p>yup wieder recht!</p>
<p>Nur da ich gesehen habe, wie weit der threadsteller sich mit c++ auskennt, dachte ich nciht, das schon STL oder so jemals gehört wurde...!<br />
Darum habe ich int* genommen!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/882755</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/882755</guid><dc:creator><![CDATA[ser1al]]></dc:creator><pubDate>Thu, 29 Sep 2005 09:13:38 GMT</pubDate></item></channel></rss>