<?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[Umlaute]]></title><description><![CDATA[<p>Hallo wir müssen in der schule ein Programm schreiben das überprüft ob ein Wort vorwärts wie rückwärts gleich ist. Dazu sollen Großbuchstaben in KB umgewandelt werden. Das Programm funktioniert im großen und ganzen schon gut. was ich aber nicht hin bekommem ist das, wenn man ein umlaut eingibt das Programm einen Fehler ausgibt und dann fragen soll ob man es nochmal ausführen möchte.</p>
<p>hier ist mein code:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
using namespace std;

int main()
{

string wort;
char kb[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','n','m','o','p','q','r','s','t','u','v','w','x','x','z'};
char gb[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','N','M','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char taste = 'j';

while( taste == 'j' || taste == 'J') 
{
cout  &lt;&lt; &quot;Text = ? &quot;;
cin &gt;&gt; wort;

	for(int i4 = 0;i4 &lt; wort.length(); i4++)
	{

		for(int i5 = 0;i5 &lt; 26; i5++)
		{
	  if (wort[i4] == gb[i5])
		  wort[i4] = kb[i5];
		}
	}

	int i = 0, i1 = wort.length() - 1;

	 for( ; i &lt;= i1 ; ++i, --i1) 
	 {
		if (wort[i1] != 'a' ||'b' ||'c' ||'d' ||'f' ||'g' ||'h' ||'i' ||'j' ||'k' ||'l' ||'m' ||'n' ||'o' ||'p' ||
				       'q' ||'r' ||'s' ||'t' ||'u' ||'v' ||'w' ||'x' ||'y' ||'z')
		{

		if( wort[i] != wort[i1] )
		{
			break;
		}

	    }

	 }

	 if( i &gt;= i1)					
		 cout &lt;&lt; &quot;Text = ? &quot; &lt;&lt; wort &lt;&lt; endl &lt;&lt; &quot; Das eingegebene Wort ist ein Palindrom.&quot; &lt;&lt; endl;

	 else
		 cout &lt;&lt; &quot;Text = ? &quot; &lt;&lt; wort &lt;&lt; endl &lt;&lt; &quot;Das eingegebene Wort ist kein Palindrom.&quot; &lt;&lt; endl;
		 cout &lt;&lt; &quot;\nWiederholen? (j/n) &quot;;
	 do
		cin.get(taste);

	 while(	taste != 'j' &amp;&amp; taste != 'J'
			 &amp;&amp; taste != 'n' &amp;&amp; taste != 'N');
	        cin.sync();

}

system(&quot;PAUSE&quot;);
}
</code></pre>
<p>/edit pumuckl: cpp-Tags spendiert. Künftig bitte selber dran denken!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/296196/umlaute</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 02:53:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/296196.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 29 Nov 2011 20:56:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Umlaute on Wed, 30 Nov 2011 07:35:53 GMT]]></title><description><![CDATA[<p>Hallo wir müssen in der schule ein Programm schreiben das überprüft ob ein Wort vorwärts wie rückwärts gleich ist. Dazu sollen Großbuchstaben in KB umgewandelt werden. Das Programm funktioniert im großen und ganzen schon gut. was ich aber nicht hin bekommem ist das, wenn man ein umlaut eingibt das Programm einen Fehler ausgibt und dann fragen soll ob man es nochmal ausführen möchte.</p>
<p>hier ist mein code:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
using namespace std;

int main()
{

string wort;
char kb[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','n','m','o','p','q','r','s','t','u','v','w','x','x','z'};
char gb[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','N','M','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char taste = 'j';

while( taste == 'j' || taste == 'J') 
{
cout  &lt;&lt; &quot;Text = ? &quot;;
cin &gt;&gt; wort;

	for(int i4 = 0;i4 &lt; wort.length(); i4++)
	{

		for(int i5 = 0;i5 &lt; 26; i5++)
		{
	  if (wort[i4] == gb[i5])
		  wort[i4] = kb[i5];
		}
	}

	int i = 0, i1 = wort.length() - 1;

	 for( ; i &lt;= i1 ; ++i, --i1) 
	 {
		if (wort[i1] != 'a' ||'b' ||'c' ||'d' ||'f' ||'g' ||'h' ||'i' ||'j' ||'k' ||'l' ||'m' ||'n' ||'o' ||'p' ||
				       'q' ||'r' ||'s' ||'t' ||'u' ||'v' ||'w' ||'x' ||'y' ||'z')
		{

		if( wort[i] != wort[i1] )
		{
			break;
		}

	    }

	 }

	 if( i &gt;= i1)					
		 cout &lt;&lt; &quot;Text = ? &quot; &lt;&lt; wort &lt;&lt; endl &lt;&lt; &quot; Das eingegebene Wort ist ein Palindrom.&quot; &lt;&lt; endl;

	 else
		 cout &lt;&lt; &quot;Text = ? &quot; &lt;&lt; wort &lt;&lt; endl &lt;&lt; &quot;Das eingegebene Wort ist kein Palindrom.&quot; &lt;&lt; endl;
		 cout &lt;&lt; &quot;\nWiederholen? (j/n) &quot;;
	 do
		cin.get(taste);

	 while(	taste != 'j' &amp;&amp; taste != 'J'
			 &amp;&amp; taste != 'n' &amp;&amp; taste != 'N');
	        cin.sync();

}

system(&quot;PAUSE&quot;);
}
</code></pre>
<p>/edit pumuckl: cpp-Tags spendiert. Künftig bitte selber dran denken!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2150745</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2150745</guid><dc:creator><![CDATA[ichbines]]></dc:creator><pubDate>Wed, 30 Nov 2011 07:35:53 GMT</pubDate></item><item><title><![CDATA[Reply to Umlaute on Tue, 29 Nov 2011 23:10:18 GMT]]></title><description><![CDATA[<p>ichbines schrieb:</p>
<blockquote>
<p>... überprüft ob ein Wort vorwärts wie rückwärts gleich ist.</p>
</blockquote>
<p>Dazu müssen die Worte sicher gleich lang sein. Du verwendest 2 Schleifen in der die innere bis 26 läuft ?</p>
<p>Ich würde die Länge prüfen. Wenn die gleich ist reicht eine Schleife.</p>
<p>ichbines schrieb:</p>
<blockquote>
<p>char kb[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','n','m','o','p','q','r','s','t','u','v','w','x','x','z'};<br />
char gb[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','N','M','O','P','Q','R','S','T','U','V','W','X','Y','Z'};</p>
</blockquote>
<p>Wozu der Umstand mit den Arrays ? Das würde doch mit tolower() viel einfacher gehen ?</p>
<p>ichbines schrieb:</p>
<blockquote>
<p>if (wort[i4] == gb[i5])<br />
wort[i4] = kb[i5];</p>
</blockquote>
<p>Das Originalwort zu verändern ist nicht sinnvoll. Der Vergleich würde z.B. mit tolower() ohne if() und Zuweisung direkt gehen.</p>
<p>ichbines schrieb:</p>
<blockquote>
<p>was ich aber nicht hin bekommem ist das, wenn man ein umlaut eingibt das Programm einen Fehler ausgibt und dann fragen soll ob man es nochmal ausführen möchte.</p>
</blockquote>
<p>Deutsche Umlaute lassen sich doch auch gross und klein schreiben ?</p>
<p>Was soll das sein ?</p>
<p>ichbines schrieb:</p>
<blockquote>
<p>if (wort[i1] != 'a' ||'b' ||'c' ||'d' ||'f' ||'g' ||'h' ||'i' ||'j' ||'k' ||'l' ||'m' ||'n' ||'o' ||'p' || ....</p>
</blockquote>
<p>Wenn man wissen möchte ob wort[i] ein Buchstabe ist fragt man isalpha() oder<br />
einen seiner Brüder <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/2150776</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2150776</guid><dc:creator><![CDATA[merano]]></dc:creator><pubDate>Tue, 29 Nov 2011 23:10:18 GMT</pubDate></item><item><title><![CDATA[Reply to Umlaute on Wed, 30 Nov 2011 06:57:12 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/u100590" rel="nofollow">Martin Richter</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/f1" rel="nofollow">MFC (Visual C++)</a> in das Forum <a href="http://www.c-plusplus.net/forum/f15" rel="nofollow">C++ (auch C++0x, bzw. C++11)</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2150835</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2150835</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Wed, 30 Nov 2011 06:57:12 GMT</pubDate></item></channel></rss>