<?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[Funktion als Ersatz von switch]]></title><description><![CDATA[<p>Hi!<br />
ich bin nicht sicher, ob das hierhin gehört, aber ich habe folgende Frage:<br />
ich habe einen Text in einer Datei und möchte nun zählen, wie viele a's, b's, c's, usw. in der Datei vorhanden sind. Dazu lese ich im Moment jedes Zeichen ein und prüfe welches es ist (hier die switch-Abfrage), um dann eine Variable zu erhöhen.<br />
Da wollte ich fragen, ob das auch anders geht, und wenn ja, wie.<br />
Danke im Voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/305232/funktion-als-ersatz-von-switch</link><generator>RSS for Node</generator><lastBuildDate>Sun, 09 Aug 2026 04:59:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/305232.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 24 Jun 2012 11:57:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Funktion als Ersatz von switch on Sun, 24 Jun 2012 11:57:31 GMT]]></title><description><![CDATA[<p>Hi!<br />
ich bin nicht sicher, ob das hierhin gehört, aber ich habe folgende Frage:<br />
ich habe einen Text in einer Datei und möchte nun zählen, wie viele a's, b's, c's, usw. in der Datei vorhanden sind. Dazu lese ich im Moment jedes Zeichen ein und prüfe welches es ist (hier die switch-Abfrage), um dann eine Variable zu erhöhen.<br />
Da wollte ich fragen, ob das auch anders geht, und wenn ja, wie.<br />
Danke im Voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2226658</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2226658</guid><dc:creator><![CDATA[Clundsch]]></dc:creator><pubDate>Sun, 24 Jun 2012 11:57:31 GMT</pubDate></item><item><title><![CDATA[Reply to Funktion als Ersatz von switch on Sun, 24 Jun 2012 12:02:20 GMT]]></title><description><![CDATA[<p>Nimm eine std::map.<br />
<a href="http://www.cplusplus.com/reference/stl/map/" rel="nofollow">http://www.cplusplus.com/reference/stl/map/</a><br />
Damit ist die Aufgabenstellung Pipifax.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2226661</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2226661</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sun, 24 Jun 2012 12:02:20 GMT</pubDate></item><item><title><![CDATA[Reply to Funktion als Ersatz von switch on Sun, 24 Jun 2012 12:04:00 GMT]]></title><description><![CDATA[<p>hört sich lustig an. Ich werd da mal nen bisschen rumprobieren. Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2226662</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2226662</guid><dc:creator><![CDATA[Clundsch]]></dc:creator><pubDate>Sun, 24 Jun 2012 12:04:00 GMT</pubDate></item><item><title><![CDATA[Reply to Funktion als Ersatz von switch on Sun, 24 Jun 2012 12:29:30 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Damit ist die Aufgabenstellung Pipifax.</p>
</blockquote>
<p>also ich hab jetzt nen bisschen damit rumgespielt und herausgefunden, wie man zugehörige Werte ausgibt. doch kann man anstatt Werten ausgeben auch Funktionen aufrufen/Variablen erhöhen? Und wenn ja, wie?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2226670</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2226670</guid><dc:creator><![CDATA[Clundsch]]></dc:creator><pubDate>Sun, 24 Jun 2012 12:29:30 GMT</pubDate></item><item><title><![CDATA[Reply to Funktion als Ersatz von switch on Sun, 24 Jun 2012 12:35:16 GMT]]></title><description><![CDATA[<p>Eine Möglichkeit wäre Funktionen in der Map zu speichern. Ansonsten, Wert rausholen (per Ref.) und verändern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2226674</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2226674</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Sun, 24 Jun 2012 12:35:16 GMT</pubDate></item><item><title><![CDATA[Reply to Funktion als Ersatz von switch on Sun, 24 Jun 2012 12:38:53 GMT]]></title><description><![CDATA[<p><a href="http://www.cplusplus.com/reference/stl/map/operator%5B%5D/" rel="nofollow">http://www.cplusplus.com/reference/stl/map/operator[]/</a></p>
<p>Du solltest googeln lernen ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2226676</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2226676</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Sun, 24 Jun 2012 12:38:53 GMT</pubDate></item><item><title><![CDATA[Reply to Funktion als Ersatz von switch on Sun, 24 Jun 2012 12:48:00 GMT]]></title><description><![CDATA[<p>theta schrieb:</p>
<blockquote>
<p>Eine Möglichkeit wäre Funktionen in der Map zu speichern</p>
</blockquote>
<p>Wie geht das? bei mir funktioniert das nicht:</p>
<pre><code>int ae(int a); //a erhöhen

int main()
{
    int a=0;
    map&lt;char,int&gt; Buchstabe;
    Buchstabe['a']=ae(a);
    //einzelne Zeichen aus der Datei einlesen
    Buchstabe[DateiInhalt];

    cout&lt;&lt;&quot;Anzahl a's: &quot;&lt;&lt;a;
}

int ae(int a)
{
    a++;
    return a;
}
</code></pre>
<p>da bleibt a bei mir 0</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2226679</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2226679</guid><dc:creator><![CDATA[Clundsch]]></dc:creator><pubDate>Sun, 24 Jun 2012 12:48:00 GMT</pubDate></item><item><title><![CDATA[Reply to Funktion als Ersatz von switch on Sun, 24 Jun 2012 12:51:44 GMT]]></title><description><![CDATA[<p>a wird ja auch nirgendwo verändert. Grundlagen von Funktionen, Funktionsparametern, Variablen, Referenzen und Gültigkeitsbereichen angucken, wenn du das anders siehst.</p>
<p>Warum nicht <code>++Buchstabe['a'];</code> ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2226685</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2226685</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sun, 24 Jun 2012 12:51:44 GMT</pubDate></item><item><title><![CDATA[Reply to Funktion als Ersatz von switch on Sun, 24 Jun 2012 12:57:12 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Warum nicht <code>++Buchstabe['a'];</code> ?</p>
</blockquote>
<p>ok, das war unüberlegt von mir. Danke, so klappts!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2226687</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2226687</guid><dc:creator><![CDATA[Clundsch]]></dc:creator><pubDate>Sun, 24 Jun 2012 12:57:12 GMT</pubDate></item></channel></rss>