<?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[Verstädnis Problem (Klasse)]]></title><description><![CDATA[<p>Hallo, ich habe ein riesiges Verständnisproblem für diese Aufgabe:</p>
<blockquote>
<p>Write a version of the transaction-processing program from §<br />
1.6 (p.24) using the Sales_data class you defined for the exercises in §<br />
2.6.1 (p.72).</p>
</blockquote>
<p>Alles schön und gut aber es geht so weiter:</p>
<p>Das Beispiel auf der Seite 24 sieht so aus:</p>
<pre><code>#include&lt;iostream&gt;
#include &quot;Sales_item.h&quot;
int main()
{
Sales_item total; //variable to hold data for the next transaction
//read the first transaction and ensure that there are data to process
if (std::cin &gt;&gt; total) {
Sales_item trans; //variable to hold the running sum
//read and process the remaining transactions
while (std::cin &gt;&gt; trans) {
//if we're still processing the same book
if (total.isbn() == trans.isbn())
total += trans; //update the running total
else {
//print results for the previous book
std::cout &lt;&lt; total &lt;&lt; std::endl;
total = trans;
//total now refers to the next book
}
}
std::cout &lt;&lt; total &lt;&lt; std::endl; //print the last transaction
} else {
//no input! warn the user
std::cerr &lt;&lt; &quot;No data?!&quot; &lt;&lt; std::endl;
return -1;
//indicate failure
}
</code></pre>
<p>und die Klasse Sales_data so:</p>
<pre><code>class Sales_data
{
public:
    const string&amp; getBookNo()    const { return bookNo; }
    const double&amp; getSalePrice() const { return salePrice; }
    const int&amp; getSoldBooks()    const { return sold_books; }
    const int&amp; getRevenueUnits() const { return revenue;}
public:
    string bookNo;
    int sold_books;
    double salePrice;
    int revenue;
};
</code></pre>
<p>Mehr Informationen gibt es nicht.. Nun habe ich dieses Problem, dass ich nicht genau weiß, was das Programm überhaupt tut...</p>
<p>Könnt ihr mir weiterhelfen?<br />
Mfg Tombaa</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/328344/verstädnis-problem-klasse</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 17:18:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/328344.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Oct 2014 14:54:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Verstädnis Problem (Klasse) on Sat, 04 Oct 2014 14:55:50 GMT]]></title><description><![CDATA[<p>Hallo, ich habe ein riesiges Verständnisproblem für diese Aufgabe:</p>
<blockquote>
<p>Write a version of the transaction-processing program from §<br />
1.6 (p.24) using the Sales_data class you defined for the exercises in §<br />
2.6.1 (p.72).</p>
</blockquote>
<p>Alles schön und gut aber es geht so weiter:</p>
<p>Das Beispiel auf der Seite 24 sieht so aus:</p>
<pre><code>#include&lt;iostream&gt;
#include &quot;Sales_item.h&quot;
int main()
{
Sales_item total; //variable to hold data for the next transaction
//read the first transaction and ensure that there are data to process
if (std::cin &gt;&gt; total) {
Sales_item trans; //variable to hold the running sum
//read and process the remaining transactions
while (std::cin &gt;&gt; trans) {
//if we're still processing the same book
if (total.isbn() == trans.isbn())
total += trans; //update the running total
else {
//print results for the previous book
std::cout &lt;&lt; total &lt;&lt; std::endl;
total = trans;
//total now refers to the next book
}
}
std::cout &lt;&lt; total &lt;&lt; std::endl; //print the last transaction
} else {
//no input! warn the user
std::cerr &lt;&lt; &quot;No data?!&quot; &lt;&lt; std::endl;
return -1;
//indicate failure
}
</code></pre>
<p>und die Klasse Sales_data so:</p>
<pre><code>class Sales_data
{
public:
    const string&amp; getBookNo()    const { return bookNo; }
    const double&amp; getSalePrice() const { return salePrice; }
    const int&amp; getSoldBooks()    const { return sold_books; }
    const int&amp; getRevenueUnits() const { return revenue;}
public:
    string bookNo;
    int sold_books;
    double salePrice;
    int revenue;
};
</code></pre>
<p>Mehr Informationen gibt es nicht.. Nun habe ich dieses Problem, dass ich nicht genau weiß, was das Programm überhaupt tut...</p>
<p>Könnt ihr mir weiterhelfen?<br />
Mfg Tombaa</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2420738</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2420738</guid><dc:creator><![CDATA[Tombaa]]></dc:creator><pubDate>Sat, 04 Oct 2014 14:55:50 GMT</pubDate></item><item><title><![CDATA[Reply to Verstädnis Problem (Klasse) on Sat, 04 Oct 2014 17:05:26 GMT]]></title><description><![CDATA[<p>Tombaa schrieb:</p>
<blockquote>
<p>Nun habe ich dieses Problem, dass ich nicht genau weiß, was das Programm überhaupt tut...</p>
<p>Könnt ihr mir weiterhelfen?</p>
</blockquote>
<p>Mehr als 2 Zeilen Kommentar pro Programmzeile können wir auch nicht liefern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2420769</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2420769</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sat, 04 Oct 2014 17:05:26 GMT</pubDate></item><item><title><![CDATA[Reply to Verstädnis Problem (Klasse) on Sun, 05 Oct 2014 06:28:50 GMT]]></title><description><![CDATA[<p>Ich hab einen dazugehörigen Link in den ersten Zeilen des Buchs dazu gefunden.<br />
Es hat sich alles erledigt.<br />
Danke für deine Mühe.</p>
<p>Mfg Tombaa</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2420824</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2420824</guid><dc:creator><![CDATA[Tombaa]]></dc:creator><pubDate>Sun, 05 Oct 2014 06:28:50 GMT</pubDate></item><item><title><![CDATA[Reply to Verstädnis Problem (Klasse) on Sun, 05 Oct 2014 18:43:08 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Mehr als 2 Zeilen Kommentar pro Programmzeile können wir auch nicht liefern.</p>
</blockquote>
<p>Haha - ich hab schon mehrere tausend zeilen code geschrieben. Mit 2 Zeilen Kommentar. Insgesamt.</p>
<p>EDIT:<br />
Hab dann nach 2 Monaten selber nicht mehr kapiert was ich mir dabei gedacht habe und wieso es trotzdem funktioniert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2420894</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2420894</guid><dc:creator><![CDATA[EOP]]></dc:creator><pubDate>Sun, 05 Oct 2014 18:43:08 GMT</pubDate></item><item><title><![CDATA[Reply to Verstädnis Problem (Klasse) on Mon, 06 Oct 2014 08:43:18 GMT]]></title><description><![CDATA[<p>Hehe, das kennt wohl jeder, der mal was Größeres gemacht hat.<br />
Wenn ich mir Sachen angucke, die ich vor mehr als zwei Jahren gemacht habe, frage ich mich auch manchmal, auf welcher Droge ich damals gewesen sein muss.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2420934</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2420934</guid><dc:creator><![CDATA[DocShoe]]></dc:creator><pubDate>Mon, 06 Oct 2014 08:43:18 GMT</pubDate></item></channel></rss>