<?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[array mit bool werten]]></title><description><![CDATA[<p>hallo!</p>
<p>ich bin ein c++ anfänger und programmiere gerade zur übung dieses spielchen nach, wo man abwechselnd oben ein steinchen reinschmeißen muss und man eine reihe von 4 steinchen erreichen muss. an einer stelle ist folgende frage aufgetaucht:<br />
angenommen ich habe ein array von boolwerten. ich will nun alle werte darin mit &amp;&amp; verbinden. man kann das natürlich per hand tun:<br />
boolarray[0] &amp;&amp; boolarray[1] &amp;&amp; ...<br />
aber das ist natürlich der falsche weg, weil möglicherweise viel zu schreiben und im nachhinein schwer zu modifizieren. gibt es eine anweisung hierfür wie das automatisch geht?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/254473/array-mit-bool-werten</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 00:44:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/254473.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 16 Nov 2009 22:08:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to array mit bool werten on Mon, 16 Nov 2009 22:08:51 GMT]]></title><description><![CDATA[<p>hallo!</p>
<p>ich bin ein c++ anfänger und programmiere gerade zur übung dieses spielchen nach, wo man abwechselnd oben ein steinchen reinschmeißen muss und man eine reihe von 4 steinchen erreichen muss. an einer stelle ist folgende frage aufgetaucht:<br />
angenommen ich habe ein array von boolwerten. ich will nun alle werte darin mit &amp;&amp; verbinden. man kann das natürlich per hand tun:<br />
boolarray[0] &amp;&amp; boolarray[1] &amp;&amp; ...<br />
aber das ist natürlich der falsche weg, weil möglicherweise viel zu schreiben und im nachhinein schwer zu modifizieren. gibt es eine anweisung hierfür wie das automatisch geht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809077</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809077</guid><dc:creator><![CDATA[cyau]]></dc:creator><pubDate>Mon, 16 Nov 2009 22:08:51 GMT</pubDate></item><item><title><![CDATA[Reply to array mit bool werten on Mon, 16 Nov 2009 22:11:54 GMT]]></title><description><![CDATA[<p>Das kannst du mit einer Schleife implementieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809082</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809082</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Mon, 16 Nov 2009 22:11:54 GMT</pubDate></item><item><title><![CDATA[Reply to array mit bool werten on Mon, 16 Nov 2009 22:26:36 GMT]]></title><description><![CDATA[<p>etwa so?</p>
<pre><code>bool arrayund(bool boolarray)
{
 int arraylänge = sizeof(boolarray)/sizeof(bool);
 for(int i = 0; i &lt; arraylänge; i++)
 {
  if(!boolarray[i])
   return false;
 }
 return true;
}
</code></pre>
<p>in meinem programm wäre das aber noch mehr schreibarbeit, deshalb wollte ich wissen, ob es auch eine einfache anweisung dafür gibt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809086</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809086</guid><dc:creator><![CDATA[cyau]]></dc:creator><pubDate>Mon, 16 Nov 2009 22:26:36 GMT</pubDate></item><item><title><![CDATA[Reply to array mit bool werten on Mon, 16 Nov 2009 22:34:20 GMT]]></title><description><![CDATA[<p>Ja, so in etwa geht das.</p>
<p>btw:<br />
Deutsche Namen gehen gerade noch, aber Umlaute?</p>
<pre><code class="language-cpp">int arraylaenge = sizeof(boolarray)/sizeof(bool);
</code></pre>
<p>Wenn, dann so, oder am besten gleich Englische Namen.</p>
<p>EDIT:<br />
Standardisiert (2.10) für die Bezeichnern sind lediglich a-zA-Z0-9 und _.<br />
Also keine Umlaute, Sonderzeichen o.ä. Also benutze auch keine!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809090</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809090</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Mon, 16 Nov 2009 22:34:20 GMT</pubDate></item><item><title><![CDATA[Reply to array mit bool werten on Mon, 16 Nov 2009 22:33:06 GMT]]></title><description><![CDATA[<p>Da gibt es unzählige Möglichkeiten. Hier was ganz altes von mir:</p>
<pre><code class="language-cpp">class Stellung
{
private:
	Farbe brett[9][8];//jeweils 2 mehr für den Todesrand
	int hoehe[9];
...

int Stellung::pruefung(Farbe farbe,int x,int y,int deltax,int deltay) const
{
   int anzahl=0;
   x+=deltax;
   y+=deltay;
   while(brett[x][y]==farbe)
   {
      ++anzahl;
      x+=deltax;
      y+=deltay;
   }
   return anzahl;
}
int Stellung::pruefungNO(Farbe farbe,int x,int y) const
{
   return pruefung(farbe,x,y,1,1);
}
int Stellung::pruefungO(Farbe farbe,int x,int y) const
{
   return pruefung(farbe,x,y,1,0);
}
int Stellung::pruefungSO(Farbe farbe,int x,int y) const
{
   return pruefung(farbe,x,y,1,-1);
}
int Stellung::pruefungS(Farbe farbe,int x,int y) const
{
   return pruefung(farbe,x,y,0,-1);
}
int Stellung::pruefungSW(Farbe farbe,int x,int y) const
{
   return pruefung(farbe,x,y,-1,-1);
}
int Stellung::pruefungW(Farbe farbe,int x,int y) const
{
   return pruefung(farbe,x,y,-1,0);
}
int Stellung::pruefungNW(Farbe farbe,int x,int y) const
{
   return pruefung(farbe,x,y,-1,1);
}
Wert Stellung::bewerte() const//Aus Sicht dessen, der gerade dran ist
{
   if(istUnentschieden())
      return UNENTSCHIEDEN;
   int x=sageLetztenZug();
   int y=hoehe[x]-1;
   Farbe farbe=werWarDran();
   if(at(x,y)==farbe)
   {
      if(pruefungS(farbe,x,y)&gt;=3) return verlorenBeiZug(zugNummer);
      if(pruefungW(farbe,x,y)+pruefungO(farbe,x,y)&gt;=3) return verlorenBeiZug(zugNummer);
      if(pruefungSW(farbe,x,y)+pruefungNO(farbe,x,y)&gt;=3) return verlorenBeiZug(zugNummer);
      if(pruefungNW(farbe,x,y)+pruefungSO(farbe,x,y)&gt;=3) return verlorenBeiZug(zugNummer);
   }
   return UNBEKANNT;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1809091</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809091</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Mon, 16 Nov 2009 22:33:06 GMT</pubDate></item></channel></rss>