<?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[per zufall Textbaustein in einem Satz ersetzen]]></title><description><![CDATA[<p>Hallo ,</p>
<p>ich lerne gerade C++ und noch nicht fit, vieleicht kann mir Jemand Hife gebe.<br />
Ich möchte eine Funktion schreiben, die mit case per Zufall einen Textbaustein auswählt und diesen dann in einem Satz dazuschreibt. Z.B in dieser Art ?<br />
mfg THO2010</p>
<p>void a1()</p>
<p>{</p>
<p>srand(time(NULL));<br />
int y1 = rand() % 2;<br />
int y2 = rand() % 2;<br />
int y3 = rand() % 2;</p>
<p>switch (y2)<br />
{<br />
case 1:<br />
string a (&quot;Ihr kreativer Sinn &quot;);<br />
break;</p>
<p>case 2:<br />
string c (&quot;Ihre Kreativität &quot;);<br />
break;</p>
<p>case 3:<br />
string b (&quot;Ihr Ideenfluss &quot;);<br />
break;</p>
<p>}</p>
<p>cout &lt;&lt; string a1 &lt;&lt; &quot;brint Ihnen endlich den verdienten Erfolg.&quot;;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/276183/per-zufall-textbaustein-in-einem-satz-ersetzen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 14:02:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/276183.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Oct 2010 13:41:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to per zufall Textbaustein in einem Satz ersetzen on Thu, 28 Oct 2010 13:41:25 GMT]]></title><description><![CDATA[<p>Hallo ,</p>
<p>ich lerne gerade C++ und noch nicht fit, vieleicht kann mir Jemand Hife gebe.<br />
Ich möchte eine Funktion schreiben, die mit case per Zufall einen Textbaustein auswählt und diesen dann in einem Satz dazuschreibt. Z.B in dieser Art ?<br />
mfg THO2010</p>
<p>void a1()</p>
<p>{</p>
<p>srand(time(NULL));<br />
int y1 = rand() % 2;<br />
int y2 = rand() % 2;<br />
int y3 = rand() % 2;</p>
<p>switch (y2)<br />
{<br />
case 1:<br />
string a (&quot;Ihr kreativer Sinn &quot;);<br />
break;</p>
<p>case 2:<br />
string c (&quot;Ihre Kreativität &quot;);<br />
break;</p>
<p>case 3:<br />
string b (&quot;Ihr Ideenfluss &quot;);<br />
break;</p>
<p>}</p>
<p>cout &lt;&lt; string a1 &lt;&lt; &quot;brint Ihnen endlich den verdienten Erfolg.&quot;;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1971943</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1971943</guid><dc:creator><![CDATA[tho2010]]></dc:creator><pubDate>Thu, 28 Oct 2010 13:41:25 GMT</pubDate></item><item><title><![CDATA[Reply to per zufall Textbaustein in einem Satz ersetzen on Thu, 28 Oct 2010 13:47:50 GMT]]></title><description><![CDATA[<p>Eher <strong>ungefähr</strong> so:</p>
<pre><code class="language-cpp">void a1()

{

srand(time(NULL));

int y2 = rand() % 2;
string a;

switch (y2)
{
case 1:
a = &quot;Ihr kreativer Sinn &quot;;
break;

case 2:
a= &quot;Ihre Kreativität &quot;;
break;

case 3:
a = &quot;Ihr Ideenfluss &quot;;
break;

}

cout &lt;&lt; a &lt;&lt; &quot; brint Ihnen endlich den verdienten Erfolg.&quot;;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1971946</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1971946</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Thu, 28 Oct 2010 13:47:50 GMT</pubDate></item><item><title><![CDATA[Reply to per zufall Textbaustein in einem Satz ersetzen on Thu, 28 Oct 2010 13:46:14 GMT]]></title><description><![CDATA[<p>leg alle strings in einen vector, mach dann zufallszahl mod vectorlänge und nimm diesen Wert aus dem vector.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1971947</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1971947</guid><dc:creator><![CDATA[zwutz]]></dc:creator><pubDate>Thu, 28 Oct 2010 13:46:14 GMT</pubDate></item><item><title><![CDATA[Reply to per zufall Textbaustein in einem Satz ersetzen on Thu, 28 Oct 2010 13:54:44 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int y2 = rand() % 2;
//...
switch (y2)
{
case 1: /*...*/
case 2: /*...*/
case 3: /*...*/
}
</code></pre>
<p>hm? oO</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1971954</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1971954</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Thu, 28 Oct 2010 13:54:44 GMT</pubDate></item></channel></rss>