<?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[Fehler bei einer Programmierung in C++]]></title><description><![CDATA[<p>#include &lt;iostream&gt;<br />
#include &lt;math.h&gt;<br />
#include &lt;string&gt;</p>
<p>using namespace std;</p>
<p>class Bauelement {</p>
<p>protected:</p>
<p>string hersteller;</p>
<p>public:</p>
<p>Bauelement() {<br />
hersteller=10;<br />
}</p>
<p>Bauelement(string hersteller_in) {<br />
hersteller=hersteller_in;<br />
}</p>
<p>Bauelement(const Bauelement &amp; b) {<br />
hersteller = b.hersteller;<br />
}</p>
<p>virtual Bauelement* operator+(const Bauelement &amp; b);<br />
virtual Bauelement* operator|(const Bauelement &amp; b);</p>
<p>};</p>
<p>class Widerstand:public Bauelement {</p>
<p>public:</p>
<p>double hersteller=50;<br />
Widerstand* operator+(const Widerstand &amp; b);<br />
Widerstand* operator|(const Widerstand &amp; b);</p>
<p>void setHersteller(string hersteller_in){</p>
<p>if(hersteller_in=50){<br />
hersteller=hersteller_in;<br />
}</p>
<p>double getHersteller(){<br />
return hersteller;<br />
}</p>
<p>void beschreibung () {<br />
cout&lt;&lt;&quot;Das Ergebnis der Widerstaende als Reihenschaltung lautet: &quot;&lt;&lt;(b.bauW1+b.bauW2)&lt;&lt;endl;<br />
cout&lt;&lt;&quot;Das Ergebnis der Widerstaende als Parallelschaltung lautet: &quot;&lt;&lt;((b.bauW1*b.bauW2)/(b.bauW1+b.bauW2))&lt;&lt;endl;</p>
<p>}</p>
<p>};</p>
<p>int main () {</p>
<p>cout&lt;&lt;&quot;Die Widerstaende der Hersteller Ohmite und Susumu werden nun als Reihen- und Parallelschaltung als Gesamtwiderstand berechnet&quot;&lt;&lt;endl;</p>
<p>r.hersteller;<br />
int r.bauW1=50;<br />
int r.bauW2=50;</p>
<p>beschreibung(r);</p>
<p>return 0;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/333282/fehler-bei-einer-programmierung-in-c</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Apr 2026 05:21:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/333282.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 23 Jun 2015 21:28:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fehler bei einer Programmierung in C++ on Tue, 23 Jun 2015 21:28:14 GMT]]></title><description><![CDATA[<p>#include &lt;iostream&gt;<br />
#include &lt;math.h&gt;<br />
#include &lt;string&gt;</p>
<p>using namespace std;</p>
<p>class Bauelement {</p>
<p>protected:</p>
<p>string hersteller;</p>
<p>public:</p>
<p>Bauelement() {<br />
hersteller=10;<br />
}</p>
<p>Bauelement(string hersteller_in) {<br />
hersteller=hersteller_in;<br />
}</p>
<p>Bauelement(const Bauelement &amp; b) {<br />
hersteller = b.hersteller;<br />
}</p>
<p>virtual Bauelement* operator+(const Bauelement &amp; b);<br />
virtual Bauelement* operator|(const Bauelement &amp; b);</p>
<p>};</p>
<p>class Widerstand:public Bauelement {</p>
<p>public:</p>
<p>double hersteller=50;<br />
Widerstand* operator+(const Widerstand &amp; b);<br />
Widerstand* operator|(const Widerstand &amp; b);</p>
<p>void setHersteller(string hersteller_in){</p>
<p>if(hersteller_in=50){<br />
hersteller=hersteller_in;<br />
}</p>
<p>double getHersteller(){<br />
return hersteller;<br />
}</p>
<p>void beschreibung () {<br />
cout&lt;&lt;&quot;Das Ergebnis der Widerstaende als Reihenschaltung lautet: &quot;&lt;&lt;(b.bauW1+b.bauW2)&lt;&lt;endl;<br />
cout&lt;&lt;&quot;Das Ergebnis der Widerstaende als Parallelschaltung lautet: &quot;&lt;&lt;((b.bauW1*b.bauW2)/(b.bauW1+b.bauW2))&lt;&lt;endl;</p>
<p>}</p>
<p>};</p>
<p>int main () {</p>
<p>cout&lt;&lt;&quot;Die Widerstaende der Hersteller Ohmite und Susumu werden nun als Reihen- und Parallelschaltung als Gesamtwiderstand berechnet&quot;&lt;&lt;endl;</p>
<p>r.hersteller;<br />
int r.bauW1=50;<br />
int r.bauW2=50;</p>
<p>beschreibung(r);</p>
<p>return 0;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2457582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2457582</guid><dc:creator><![CDATA[Cobain]]></dc:creator><pubDate>Tue, 23 Jun 2015 21:28:14 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler bei einer Programmierung in C++ on Tue, 23 Jun 2015 21:38:38 GMT]]></title><description><![CDATA[<blockquote>
<p>Fehler bei einer Programmierung in C++</p>
</blockquote>
<p>Das ist bedauerlich. Aber vielleicht beruhigt es dich zu wissen, dass es viele C++-Programme gibt, die Fehler haben.</p>
<p>SCNR,<br />
Finnegan</p>
<p>P.S.: Wenn du eine sinnvolle Antwort haben möchtest, wäre es hilfreich zumindest ansatzweise zu beschreiben, wie sich der Fehler manifestiert <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> (Code-Tags und ein aussagekräftigerer Thread-Titel wären ebenfalls ein Plus)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2457583</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2457583</guid><dc:creator><![CDATA[Finnegan]]></dc:creator><pubDate>Tue, 23 Jun 2015 21:38:38 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler bei einer Programmierung in C++ on Tue, 23 Jun 2015 22:30:59 GMT]]></title><description><![CDATA[<p>Hier eine Liste deiner Fehler mit Zeilennummer und kurzer Erklärung:</p>
<pre><code>test.cc:73:3: error: expected ‘}’ at end of input
   }
   ^
test.cc: In member function ‘void Widerstand::setHersteller(std::string)’:
test.cc:43:24: error: could not convert ‘hersteller_in.std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::operator=&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;(50)’ from ‘std::basic_string&lt;char&gt;’ to ‘bool’
     if(hersteller_in=50){
                        ^
test.cc:44:17: error: cannot convert ‘std::string {aka std::basic_string&lt;char&gt;}’ to ‘double’ in assignment
       hersteller=hersteller_in;
                 ^
test.cc:47:27: error: a function-definition is not allowed here before ‘{’ token
     double getHersteller(){
                           ^
test.cc:51:26: error: a function-definition is not allowed here before ‘{’ token
     void beschreibung () {
                          ^
test.cc: In member function ‘int Widerstand::main()’:
test.cc:66:5: error: ‘r’ was not declared in this scope
     r.hersteller;
     ^
test.cc:67:10: error: expected initializer before ‘.’ token
     int r.bauW1=50;
          ^
test.cc:68:10: error: expected initializer before ‘.’ token
     int r.bauW2=50;
          ^
test.cc:70:19: error: ‘beschreibung’ was not declared in this scope
     beschreibung(r);
                   ^
test.cc: At global scope:
test.cc:73:3: error: expected unqualified-id at end of input
   }
   ^
</code></pre>
<p>Damit sollte wohl alles klar sein.</p>
<p>PS: Ich bin mal nicht ganz so fies, auch wenn der Threadersteller es bei solch einem Beitrag nicht anders verdient (vielleicht sollte er mal die Beiträge in meiner Signatur lesen) und setze in Zeile 46 eine schließende Klammer. Es verbleibt:</p>
<pre><code>test.cc: In member function ‘void Widerstand::setHersteller(std::string)’:
test.cc:43:24: error: could not convert ‘hersteller_in.std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::operator=&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;(50)’ from ‘std::basic_string&lt;char&gt;’ to ‘bool’
     if(hersteller_in=50){
                        ^
test.cc:44:17: error: cannot convert ‘std::string {aka std::basic_string&lt;char&gt;}’ to ‘double’ in assignment
       hersteller=hersteller_in;
                 ^
test.cc: In member function ‘void Widerstand::beschreibung()’:
test.cc:52:74: error: ‘b’ was not declared in this scope
     cout&lt;&lt;&quot;Das Ergebnis der Widerstaende als Reihenschaltung lautet: &quot;&lt;&lt;(b.bauW1+b.bauW2)&lt;&lt;endl;
                                                                          ^
test.cc: In function ‘int main()’:
test.cc:66:3: error: ‘r’ was not declared in this scope
   r.hersteller;
   ^
test.cc:67:8: error: expected initializer before ‘.’ token
   int r.bauW1=50;
        ^
test.cc:68:8: error: expected initializer before ‘.’ token
   int r.bauW2=50;
        ^
test.cc:70:17: error: ‘beschreibung’ was not declared in this scope
   beschreibung(r);
</code></pre>
<p>Das sollte nun aber wirklich selbsterklärend sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2457586</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2457586</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 23 Jun 2015 22:30:59 GMT</pubDate></item></channel></rss>