<?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, if-abfrage ohne übereinstimmungen]]></title><description><![CDATA[<p>Hi,<br />
ich versuch mich grad ein bisschen an c++...<br />
Anfänger, also nicht schimpfen, ja...</p>
<pre><code>char eingabe[100];
    cout &lt;&lt; &quot;Was willst du nun tun....&quot; &lt;&lt; endl;
cin &gt;&gt; eingabe;
if (eingabe == &quot;x&quot;)
{}
if (eingabe == &quot;y&quot;)
{}
</code></pre>
<p>So, mein Problem:<br />
Komplieren, alles klappt. Wenn ich aber an diese Stelle komme, dann wir keine der if-Schleifen ausgelöst. (nein, ich hab mich nicht jedesmal vertippt.)</p>
<p>Hoffe ihr könnt mir helfen.<br />
Falls noch andere Code-Teile relevant sind werde ich die natürlich auch posten.<br />
Ich möchte aber kein<br />
&quot;1. .... 2. .... 3. ....&quot; machen.</p>
<p>Vielen dank schonmal</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/250918/char-if-abfrage-ohne-übereinstimmungen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 19:50:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/250918.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 26 Sep 2009 12:38:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to char, if-abfrage ohne übereinstimmungen on Sat, 26 Sep 2009 12:38:02 GMT]]></title><description><![CDATA[<p>Hi,<br />
ich versuch mich grad ein bisschen an c++...<br />
Anfänger, also nicht schimpfen, ja...</p>
<pre><code>char eingabe[100];
    cout &lt;&lt; &quot;Was willst du nun tun....&quot; &lt;&lt; endl;
cin &gt;&gt; eingabe;
if (eingabe == &quot;x&quot;)
{}
if (eingabe == &quot;y&quot;)
{}
</code></pre>
<p>So, mein Problem:<br />
Komplieren, alles klappt. Wenn ich aber an diese Stelle komme, dann wir keine der if-Schleifen ausgelöst. (nein, ich hab mich nicht jedesmal vertippt.)</p>
<p>Hoffe ihr könnt mir helfen.<br />
Falls noch andere Code-Teile relevant sind werde ich die natürlich auch posten.<br />
Ich möchte aber kein<br />
&quot;1. .... 2. .... 3. ....&quot; machen.</p>
<p>Vielen dank schonmal</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1784548</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1784548</guid><dc:creator><![CDATA[darkrib]]></dc:creator><pubDate>Sat, 26 Sep 2009 12:38:02 GMT</pubDate></item><item><title><![CDATA[Reply to char, if-abfrage ohne übereinstimmungen on Sat, 26 Sep 2009 12:43:29 GMT]]></title><description><![CDATA[<p>Nimm <code>std::string</code> statt <code>char</code> -Arrays, damit sparst du dir viele Probleme. Ansonsten müsstest du die Funktion <code>strcmp()</code> statt <code>operator==</code> benutzen. Aber glaub mir, die <code>string</code> -Klasse ist viel komfortabler und sicherer.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1784549</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1784549</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sat, 26 Sep 2009 12:43:29 GMT</pubDate></item><item><title><![CDATA[Reply to char, if-abfrage ohne übereinstimmungen on Sat, 26 Sep 2009 12:51:25 GMT]]></title><description><![CDATA[<p>könntest du mir vllt grade meinen quelltext dann anpassen (als beispiel) ich denke das würde für mich reichen, um den gesamten quelltext zu ändern.</p>
<p>vielen dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1784550</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1784550</guid><dc:creator><![CDATA[darkrib]]></dc:creator><pubDate>Sat, 26 Sep 2009 12:51:25 GMT</pubDate></item><item><title><![CDATA[Reply to char, if-abfrage ohne übereinstimmungen on Sat, 26 Sep 2009 13:01:57 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;iostream&gt;
// mit &quot;using namespace std;&quot; entfallen unten sämtliche &quot;std::&quot; ;-)

// ...

std::string eingabe;
std::cout &lt;&lt; &quot;Was willst du nun tun....&quot; &lt;&lt; std::endl;
std::cin &gt;&gt; eingabe;
if (eingabe.compare(&quot;x&quot;) == 0) // hier kann auch einfach stehen: eingabe == &quot;x&quot;, da std::string einen operator== definiert.
{
// mach irgendwas, wenn eingabe == &quot;x&quot;
}
if (eingabe.compare(&quot;y&quot;) == 0) // das gleiche wie oben
{
// mach irgendwas, wenn eingabe == &quot;y&quot;
}
</code></pre>
<p>und variante mit strcmp</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

// ...

char eingabe[100];
cout &lt;&lt; &quot;Was willst du nun tun....&quot; &lt;&lt; endl;
cin &gt;&gt; eingabe;
if (!strcmp(eingabe, &quot;x&quot;)) // gleichbedeutend mit: strcmp(eingabe, &quot;x&quot;) == 0
{
// mach irgendwas, wenn eingabe == &quot;x&quot;
}
// usw.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1784553</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1784553</guid><dc:creator><![CDATA[DrakoXP]]></dc:creator><pubDate>Sat, 26 Sep 2009 13:01:57 GMT</pubDate></item><item><title><![CDATA[Reply to char, if-abfrage ohne übereinstimmungen on Sat, 26 Sep 2009 13:01:05 GMT]]></title><description><![CDATA[<p>Wieso <code>compare()</code> auf 0 prüfen? Für irgendwas gibts den <code>operator==</code> .</p>
<pre><code class="language-cpp">if (eingabe == &quot;y&quot;)
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1784555</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1784555</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sat, 26 Sep 2009 13:01:05 GMT</pubDate></item><item><title><![CDATA[Reply to char, if-abfrage ohne übereinstimmungen on Sat, 26 Sep 2009 13:04:17 GMT]]></title><description><![CDATA[<p>Vielen dank schonmal, ich werd jetzt mal des ganze mit string probieren...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1784560</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1784560</guid><dc:creator><![CDATA[darkrib]]></dc:creator><pubDate>Sat, 26 Sep 2009 13:04:17 GMT</pubDate></item><item><title><![CDATA[Reply to char, if-abfrage ohne übereinstimmungen on Sat, 26 Sep 2009 13:09:00 GMT]]></title><description><![CDATA[<p>Super, es funktioniert.<br />
Danke dafür.<br />
Werd dann mal weitermachen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1784562</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1784562</guid><dc:creator><![CDATA[darkrib]]></dc:creator><pubDate>Sat, 26 Sep 2009 13:09:00 GMT</pubDate></item></channel></rss>