<?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[&amp;quot;Grafik-Aufgabe&amp;quot; (split aus Zinseszins)]]></title><description><![CDATA[<p>Write a C++ program that asks the user to input an odd integer value (&gt;=5). Your program produces a diamond enclosed by a square of the given size.</p>
<p>For example,</p>
<pre><code>Enter an odd integer

9

  *********
  *  * *  *
  * *   * *
  **     **
  *       *
  **     **
  * *   * *
  *  * *  *
  *********
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/193858/quot-grafik-aufgabe-quot-split-aus-zinseszins</link><generator>RSS for Node</generator><lastBuildDate>Mon, 28 Sep 2026 08:35:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/193858.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 30 Sep 2007 15:03:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &amp;quot;Grafik-Aufgabe&amp;quot; (split aus Zinseszins) on Mon, 01 Oct 2007 05:47:19 GMT]]></title><description><![CDATA[<p>Write a C++ program that asks the user to input an odd integer value (&gt;=5). Your program produces a diamond enclosed by a square of the given size.</p>
<p>For example,</p>
<pre><code>Enter an odd integer

9

  *********
  *  * *  *
  * *   * *
  **     **
  *       *
  **     **
  * *   * *
  *  * *  *
  *********
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1375377</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1375377</guid><dc:creator><![CDATA[cardanadam]]></dc:creator><pubDate>Mon, 01 Oct 2007 05:47:19 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;Grafik-Aufgabe&amp;quot; (split aus Zinseszins) on Sun, 30 Sep 2007 15:17:50 GMT]]></title><description><![CDATA[<p>cardanadam schrieb:</p>
<blockquote>
<p>Write a C++ program that asks the user to input an odd integer value (&gt;=5). Your program produces a diamond enclosed by a square of the given size.</p>
</blockquote>
<p>First, you should open a new topic for this question and not just write in an existing one.<br />
Second, you actually didn't ask a question <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
Third, don't you have any idea how to solve it? Or do you already have any skills in C++?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1375389</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1375389</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Sun, 30 Sep 2007 15:17:50 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;Grafik-Aufgabe&amp;quot; (split aus Zinseszins) on Mon, 01 Oct 2007 05:46:59 GMT]]></title><description><![CDATA[<p>Fourth, I would use a for-loop to build up each row of the output (just look at the example to determine how each row ist constructed).</p>
<p>(solves &quot;first&quot; by using his mod-powers)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1375648</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1375648</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Mon, 01 Oct 2007 05:46:59 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;Grafik-Aufgabe&amp;quot; (split aus Zinseszins) on Mon, 01 Oct 2007 12:35:01 GMT]]></title><description><![CDATA[<p>I think that this is a really interesting thread and so, i sat down and wrote a little bit of code for that problem but attention: The code ISN'T optimized, so there will be much faster programs to solve the problems, I'm sure.</p>
<p>Have fun with the code and I hope, it'll be useful for you</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

using namespace std;

int plotdiamond(int links, int rechts, int max)
{
	cout &lt;&lt; &quot;*&quot;;
	for(int i = 2; i &lt; max; i++)
	{
		if(i == links || i == rechts)
		{
			cout &lt;&lt; &quot;*&quot;;
		}
		else
		{
			cout &lt;&lt; &quot; &quot;;	
		}
	}
	cout &lt;&lt; &quot;*&quot; &lt;&lt; endl;
}

int plotdiamond(int max)
{
	for(int i = 1; i &lt;= max; i++)
	{
		cout &lt;&lt; &quot;*&quot;;	
	}
	cout &lt;&lt; endl;
}

int main()
{
	int first, input, xl, xr;
	bool change = false;

	cout &lt;&lt; &quot;Insert an odd integer value:&quot;;
	cin &gt;&gt; input;

	first = (input+1)/2;
	xl = first;
	xr = first;

	plotdiamond(input);

	for(int i = 1; i &lt; input-1; i++)
	{
		if(xl-1 == -1 || xr+1 == input+1 || change == true)
		{
			change = true;
			plotdiamond(++xl, --xr, input);
		}
		else
		{
			plotdiamond(--xl, ++xr, input);
		}
	}

	plotdiamond(input);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1375931</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1375931</guid><dc:creator><![CDATA[spuxx]]></dc:creator><pubDate>Mon, 01 Oct 2007 12:35:01 GMT</pubDate></item></channel></rss>