<?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[abfrage für gross und klein buchstaben im string]]></title><description><![CDATA[<p>Hallo, habe mit C ein program geschrieben welches einen text im string speichert und mir die anzahl der gschriebenen zeichen ausgibt.</p>
<p>nun möchte ich noch wissen wieviele gross und kleinbuchstaben sich in dem geschriebenen text befinden!</p>
<p>das ganze sieht so aus :</p>
<p>int i,j,k;<br />
//a=50;<br />
j=0;<br />
k=0;<br />
char text[50];</p>
<p>cout&lt;&lt;&quot;bitte geben sie ein text ein&quot;&lt;&lt;endl;</p>
<p>gets(text);</p>
<p>cout&lt;&lt;&quot;der eingebebene text war:&quot;&lt;&lt;text&lt;&lt;&quot;\n\n&quot;&lt;&lt;endl;</p>
<p>cout&lt;&lt;&quot;der text hat folgende zeichen anzahl&quot;&lt;&lt;&quot; &quot;&lt;&lt;(unsigned)strlen(text)&lt;&lt;endl;</p>
<p>if (text[50]&lt;='A' || text[50]&gt;='Z')<br />
{<br />
j++;<br />
}</p>
<p>if (text[50]&lt;='a' || text[50]&gt;='z')<br />
{<br />
k++;<br />
}</p>
<p>cout&lt;&lt;&quot;anzahl der grossbuchstaben:&quot;&lt;&lt;&quot; &quot;&lt;&lt;j&lt;&lt;&quot;\n&quot;&lt;&lt;endl;<br />
cout&lt;&lt;&quot;anzahl der kleinbuchstaben:&quot;&lt;&lt;&quot; &quot;&lt;&lt;k&lt;&lt;&quot;\n&quot;&lt;&lt;endl;<br />
}</p>
<p>Leider zählt das program j und k nicht hoch! kann mir jemand helfen wie ich dieses problem löse??</p>
<p>Vielen dank!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/294911/abfrage-für-gross-und-klein-buchstaben-im-string</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 17:20:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/294911.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 03 Nov 2011 16:10:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to abfrage für gross und klein buchstaben im string on Thu, 03 Nov 2011 16:10:50 GMT]]></title><description><![CDATA[<p>Hallo, habe mit C ein program geschrieben welches einen text im string speichert und mir die anzahl der gschriebenen zeichen ausgibt.</p>
<p>nun möchte ich noch wissen wieviele gross und kleinbuchstaben sich in dem geschriebenen text befinden!</p>
<p>das ganze sieht so aus :</p>
<p>int i,j,k;<br />
//a=50;<br />
j=0;<br />
k=0;<br />
char text[50];</p>
<p>cout&lt;&lt;&quot;bitte geben sie ein text ein&quot;&lt;&lt;endl;</p>
<p>gets(text);</p>
<p>cout&lt;&lt;&quot;der eingebebene text war:&quot;&lt;&lt;text&lt;&lt;&quot;\n\n&quot;&lt;&lt;endl;</p>
<p>cout&lt;&lt;&quot;der text hat folgende zeichen anzahl&quot;&lt;&lt;&quot; &quot;&lt;&lt;(unsigned)strlen(text)&lt;&lt;endl;</p>
<p>if (text[50]&lt;='A' || text[50]&gt;='Z')<br />
{<br />
j++;<br />
}</p>
<p>if (text[50]&lt;='a' || text[50]&gt;='z')<br />
{<br />
k++;<br />
}</p>
<p>cout&lt;&lt;&quot;anzahl der grossbuchstaben:&quot;&lt;&lt;&quot; &quot;&lt;&lt;j&lt;&lt;&quot;\n&quot;&lt;&lt;endl;<br />
cout&lt;&lt;&quot;anzahl der kleinbuchstaben:&quot;&lt;&lt;&quot; &quot;&lt;&lt;k&lt;&lt;&quot;\n&quot;&lt;&lt;endl;<br />
}</p>
<p>Leider zählt das program j und k nicht hoch! kann mir jemand helfen wie ich dieses problem löse??</p>
<p>Vielen dank!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139894</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139894</guid><dc:creator><![CDATA[volume123]]></dc:creator><pubDate>Thu, 03 Nov 2011 16:10:50 GMT</pubDate></item><item><title><![CDATA[Reply to abfrage für gross und klein buchstaben im string on Thu, 03 Nov 2011 16:23:17 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;algorithm&gt;
#include &lt;string&gt;
#include &lt;iostream&gt;
#include &lt;locale&gt;

bool uppcase(char c)
{
    std::locale loc;
    return std::isupper(c, loc);
}

bool lowercase(char c)
{
    std::locale loc;
    return std::islower(c, loc);
}

int main()
{
    std::string input;
    //Einlesen
    std::getline(std::cin, input);

    //Ausgeben
    std::cout &lt;&lt; &quot;Input length: &quot; &lt;&lt; input.size() &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;Uppercase letters: &quot; &lt;&lt; std::count_if(input.begin(), input.end(), uppcase) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;Lowercase letters: &quot;  &lt;&lt; std::count_if(input.begin(), input.end(), lowercase) &lt;&lt; std::endl;
}
</code></pre>
<p>Hier werden die Funktionen beschrieben:<br />
<a href="http://www.cplusplus.com/reference/string/string/" rel="nofollow">string</a><br />
<a href="http://www.cplusplus.com/reference/clibrary/cctype/isupper/" rel="nofollow">isupper</a><br />
<a href="http://www.cplusplus.com/reference/clibrary/cctype/islower/" rel="nofollow">islower</a><br />
<a href="http://www.cplusplus.com/reference/string/getline/" rel="nofollow">getline</a><br />
<a href="http://www.cplusplus.com/reference/algorithm/count_if/" rel="nofollow">count_if</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139901</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139901</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Thu, 03 Nov 2011 16:23:17 GMT</pubDate></item><item><title><![CDATA[Reply to abfrage für gross und klein buchstaben im string on Thu, 03 Nov 2011 16:24:11 GMT]]></title><description><![CDATA[<p>Um dein eigenes Programm auszubessern (das von Tachyon ist um so vieles besser und wenn's nur die Benutzung von std::string ist): Du brauchst da etwas schleifiges.</p>
<p>edit: Wobei man Tachyon den Vorwurf machen könnte und sollte, dass er unnötigerweise 2x iteriert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139903</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139903</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 03 Nov 2011 16:24:11 GMT</pubDate></item><item><title><![CDATA[Reply to abfrage für gross und klein buchstaben im string on Thu, 03 Nov 2011 16:41:30 GMT]]></title><description><![CDATA[<p>vielen dank euch beiden für eure hilfe, aber ich verstehe bei tachyon seinem programm nur bahnhof!!!!</p>
<p>habe noch nicht so lange erfahrung mit programmiern und wollte das programm sehr einfach halten.</p>
<p>könnt ihr mir trozdem nochmal zeigen wie ich das was ich geschrieben habe verbessern kann???</p>
<p>mit der if bedingung müsste es doch möglich sein, oder?? ist halt das problem das es nicht hoch zählt.....habe es schon mit ner schleife versucht das prog zeigt mir aber trozdem das es nicht hochzählt....</p>
<p>Vielen dank.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139913</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139913</guid><dc:creator><![CDATA[volume123]]></dc:creator><pubDate>Thu, 03 Nov 2011 16:41:30 GMT</pubDate></item><item><title><![CDATA[Reply to abfrage für gross und klein buchstaben im string on Thu, 03 Nov 2011 16:55:09 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int i,j,k;
	j=0;
	k=0;
	char text[50];

	cout&lt;&lt;&quot;bitte geben sie ein text ein&quot;&lt;&lt;endl;
	cin&gt;&gt;text;

	cout&lt;&lt;&quot;der eingebebene text war:&quot;&lt;&lt;text&lt;&lt;&quot;\n\n&quot;&lt;&lt;endl;
	cout&lt;&lt;&quot;der text hat folgende zeichen anzahl&quot;&lt;&lt;&quot; &quot;&lt;&lt;(unsigned)strlen(text)&lt;&lt;endl;

	//hier muss ein Schleife kommen sonst klappt es nicht
	for(int i = 0; i&lt;strlen(text);i++){
		if (text[i]&gt;='A' &amp;&amp; text[i]&lt;='Z')
		{
			j++;
		}
		if (text[i]&gt;='a' &amp;&amp; text[i]&lt;='z')
		{
			k++;
		}
	}
	cout&lt;&lt;&quot;anzahl der grossbuchstaben:&quot;&lt;&lt;&quot; &quot;&lt;&lt;j&lt;&lt;&quot;\n&quot;&lt;&lt;endl;
	cout&lt;&lt;&quot;anzahl der kleinbuchstaben:&quot;&lt;&lt;&quot; &quot;&lt;&lt;k&lt;&lt;&quot;\n&quot;&lt;&lt;endl;
</code></pre>
<p>Das ist mal der Code dazu. Du hast viele Denkfehler gehabt und kannst es ja mit deinen Vergleichen <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>
<p>Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139915</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139915</guid><dc:creator><![CDATA[Beobachter01]]></dc:creator><pubDate>Thu, 03 Nov 2011 16:55:09 GMT</pubDate></item><item><title><![CDATA[Reply to abfrage für gross und klein buchstaben im string on Thu, 03 Nov 2011 17:52:12 GMT]]></title><description><![CDATA[<p>hey super danke!!! hatte es auch mal mit ner schleife versucht aber hatte die schleifen obergrenze mit text[50] angegeben. so ist es aber logisch!!!</p>
<p>danke nochmal!!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139936</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139936</guid><dc:creator><![CDATA[volume123]]></dc:creator><pubDate>Thu, 03 Nov 2011 17:52:12 GMT</pubDate></item></channel></rss>