<?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[cout über for-Schleife]]></title><description><![CDATA[<p>Hi erstmal, bin Anfänger und bekomm folgenden Code nicht richtig in Gang...<br />
Möchte in einer Win32-Console-App eine Zeichenfolge (Wort) , 1. Zahl, 2. Zahl einlesen. Ausgegeben werden soll Das eingegebene Wort, die Zeichenfolge die sich zwischen den Positionen von der 1. und der 2. Zahl befinden.</p>
<pre><code>#include &lt;iostream.h&gt;

void main()
{
	char Wort1[60];
	int Zahl1;
	int Zahl2;
	cout &lt;&lt; endl &lt;&lt; &quot;Wort eingeben: &quot; &lt;&lt; endl;
	cin &gt;&gt; Wort1;
	cout &lt;&lt; &quot;Zeichenkette anzeigen von: &quot;;
	cin &gt;&gt; Zahl1;
	cout &lt;&lt; &quot;                      bis: &quot;;
	cin &gt;&gt; Zahl2;
	for (Zahl1; Zahl1 &gt; Zahl2; Zahl1++);
	{
	cout &lt;&lt; Wort1[Zahl1 - 1] &lt;&lt; endl;
	};
}
</code></pre>
<p>Was bitte stimmt nicht??? Er gibt mir nur das Zeichen bei Zahl1 aus. Irgendwie durchläuft er die for-Schleife nicht richtig... Danke im voraus.</p>
<p>Mfg N8walk3r</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/184893/cout-über-for-schleife</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 00:10:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/184893.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 Jun 2007 07:04:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to cout über for-Schleife on Wed, 20 Jun 2007 07:04:44 GMT]]></title><description><![CDATA[<p>Hi erstmal, bin Anfänger und bekomm folgenden Code nicht richtig in Gang...<br />
Möchte in einer Win32-Console-App eine Zeichenfolge (Wort) , 1. Zahl, 2. Zahl einlesen. Ausgegeben werden soll Das eingegebene Wort, die Zeichenfolge die sich zwischen den Positionen von der 1. und der 2. Zahl befinden.</p>
<pre><code>#include &lt;iostream.h&gt;

void main()
{
	char Wort1[60];
	int Zahl1;
	int Zahl2;
	cout &lt;&lt; endl &lt;&lt; &quot;Wort eingeben: &quot; &lt;&lt; endl;
	cin &gt;&gt; Wort1;
	cout &lt;&lt; &quot;Zeichenkette anzeigen von: &quot;;
	cin &gt;&gt; Zahl1;
	cout &lt;&lt; &quot;                      bis: &quot;;
	cin &gt;&gt; Zahl2;
	for (Zahl1; Zahl1 &gt; Zahl2; Zahl1++);
	{
	cout &lt;&lt; Wort1[Zahl1 - 1] &lt;&lt; endl;
	};
}
</code></pre>
<p>Was bitte stimmt nicht??? Er gibt mir nur das Zeichen bei Zahl1 aus. Irgendwie durchläuft er die for-Schleife nicht richtig... Danke im voraus.</p>
<p>Mfg N8walk3r</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309596</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309596</guid><dc:creator><![CDATA[N8walk3r]]></dc:creator><pubDate>Wed, 20 Jun 2007 07:04:44 GMT</pubDate></item><item><title><![CDATA[Reply to cout über for-Schleife on Wed, 20 Jun 2007 07:11:32 GMT]]></title><description><![CDATA[<p>Versuch's mal mit einem &lt; als Schleifenbedingung - for() wird so lange ausgeführt, wie diese Bedingung <strong>wahr</strong> ist. (und außerdem hast du ein paar Semikolons zu viel gesetzt - der Rumpf der for-Schleife ist eine leere Anweisung und der cout-Block wird nach Ende der Schleife ausgeführt)</p>
<p>PS: Und gewöhn dir gleich saubere Porgrammierung an, bevor sich dieser Stil festsetzt - es heißt &quot;#include &lt;iostream&gt;&quot; (zusammen mit std::cout) und &quot;int main()&quot;. Und anstelle des char-Arrays solltest du std::string verwenden - ist sicherer und leichter zu handhaben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309604</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309604</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Wed, 20 Jun 2007 07:11:32 GMT</pubDate></item><item><title><![CDATA[Reply to cout über for-Schleife on Wed, 20 Jun 2007 09:52:27 GMT]]></title><description><![CDATA[<p>Klappt leider auch nicht wirklich... Ist dasselbe in grün...<br />
Vorher hat er mir immer das Zeichen ausgegeben, dass dann dem Wert Zahl1 entspricht. Also Beispiel:</p>
<p>Wort: Microsoft<br />
ausgabe von: 2<br />
bis: 4</p>
<p>vorher: &quot;i&quot; wurde ausgegeben<br />
nachher: &quot;r&quot; wurde ausgegeben</p>
<p>irgendwo funktioniert die Schleife nicht richtig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309740</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309740</guid><dc:creator><![CDATA[N8walker]]></dc:creator><pubDate>Wed, 20 Jun 2007 09:52:27 GMT</pubDate></item><item><title><![CDATA[Reply to cout über for-Schleife on Wed, 20 Jun 2007 10:03:57 GMT]]></title><description><![CDATA[<p>for (...) KEIN SMIKOLON {....}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309744</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309744</guid><dc:creator><![CDATA[cpplinux]]></dc:creator><pubDate>Wed, 20 Jun 2007 10:03:57 GMT</pubDate></item><item><title><![CDATA[Reply to cout über for-Schleife on Wed, 20 Jun 2007 10:37:15 GMT]]></title><description><![CDATA[<p>Mach einfach</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

int main()
{
char wort[10] = &quot;ABCDEFGHI&quot;;
int Zahl1, Zahl2;
cout&lt;&lt;&quot;Bitte zwei Zahlen eingeben, erste Zahl: &quot;;
cin&gt;&gt;Zahl1;
cout&lt;&lt;&quot;\n&quot;&lt;&lt;&quot;Zahl2: &quot;;
cin&gt;&gt;Zahl2;
cout&lt;&lt;&quot;\n&quot;;
for(zahl1 &gt; zahl2; --zahl1)
{
cout&lt;&lt;wort[zahl1]&lt;&lt;endl;
}
return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1309765</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309765</guid><dc:creator><![CDATA[.......]]></dc:creator><pubDate>Wed, 20 Jun 2007 10:37:15 GMT</pubDate></item><item><title><![CDATA[Reply to cout über for-Schleife on Wed, 20 Jun 2007 10:43:24 GMT]]></title><description><![CDATA[<p>C**++**:</p>
<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;iostream&gt;

int main( ) {

	std::string word;
	std::string::size_type begin, end;

	std::cin &gt;&gt; word;
	std::cin &gt;&gt; begin;
	std::cin &gt;&gt; end;

	std::cout &lt;&lt; word.substr( begin, end - begin - 1 ) &lt;&lt; std::endl;
}
</code></pre>
<p>greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309769</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309769</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 20 Jun 2007 10:43:24 GMT</pubDate></item></channel></rss>