<?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[Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart]]></title><description><![CDATA[<p>Hallo liebe Gemeinde.</p>
<p>Ich wurde schon von ein paar Leuten, u. A. von SeppJ, daraufhin gewiesen, dass mein Programmierstil nicht dem C++ Standard entspricht.</p>
<p>SeppJ formulierte es so:</p>
<p>&quot;Dein Stil ist übrigens tatsächlich das berüchtigte &quot;C mit cout&quot;, welches in schlechten Büchern und von schlechten Dozenten als C++ verkauft wird.&quot;</p>
<p>Mein Problem ist einfach, dass mir momentan nur das Buch &quot;C++ in 21 Tagen&quot; vorliegt.</p>
<p>Zumindest habe ich folgenden Quellcode hinbekommen:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cmath&gt;
using namespace std;

float Add(float x, float y) // Addition
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Addition!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot; x + y = z &quot; &lt;&lt; endl;
	cout &lt;&lt; endl;
	return (x+y);
}
float Sub(float x, float y) // Subtraktion
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Subtraktion!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot; x - y = z &quot; &lt;&lt; endl;
	cout &lt;&lt; endl;
	return (x-y);
}
float Mul(float x, float y) //Multiplikation
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Multiplikation!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot; x*y = z &quot; &lt;&lt; endl;
	cout &lt;&lt; endl;
	return (x*y);
}
float Div(float x, float y) //Division
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Division!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;x / y = z!&quot; &lt;&lt; endl;
	float z = x/y;
	cout &lt;&lt; endl;
	return (z);
}
float Wur(float x) // Wurzel
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Wurzel!&quot; &lt;&lt; endl;
	return (sqrt(x));
}
float Pot(float x, float y) // Potenz
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Potenz!&quot; &lt;&lt; endl;
	return (pow(x,y));
}

int main()
{
	cout &lt;&lt; &quot;Einsatz von Variablen!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Wie gross waren gleich wieder die einzelnen Datentypen?&quot; &lt;&lt; endl;
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Greosse eines int:\t			&quot;&lt;&lt; sizeof(int)			&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines short int:\t\t	&quot;&lt;&lt; sizeof(short int)	&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines long int:\t\t\t	&quot;&lt;&lt; sizeof(long int)	&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines char:\t\t		&quot;&lt;&lt; sizeof(char)		&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines float:\t\t		&quot;&lt;&lt; sizeof(float)		&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines double:\t\t		&quot;&lt;&lt; sizeof(double)		&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines bool:\t\t		&quot;&lt;&lt; sizeof(bool)		&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; endl;
	float a,b,c;
	cout &lt;&lt; &quot;Nun wird gerechnet!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Zwei Zahlen bitte!&quot; &lt;&lt; endl;
	cin  &gt;&gt; a;
	cin  &gt;&gt; b;
	c=Add(a,b); // Aufruf der Funktion Addition
	cout &lt;&lt; &quot;Nach Addition ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	c=Sub(a,b); // Aufruf der Funktion Subtraktion
	cout &lt;&lt; &quot;Nach Subtraktion ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	c=Mul(a,b); // Aufruf der Funktion Multiplikation
	cout &lt;&lt; &quot;Nach Multiplikation ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	c=Div(a,b); // Aufruf der Funktion Division
	cout &lt;&lt; &quot;Nach Division ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	c=Wur(a); // Aufruf der Funktion Wurzel
	cout &lt;&lt; &quot;Nach Wurzel ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	c=Pot(a,b); // Aufruf der Funktion Potenz
	cout &lt;&lt; &quot;Nach Potenz ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	cout &lt;&lt; endl;

	return 0;
}
</code></pre>
<p>Mein Dozent pflegt folgenden Programmierstil:</p>
<pre><code class="language-cpp">#include &quot;Zufallszahl.h&quot; 
#include &lt;time.h&gt;													//Header-Datei für time bei srand
#include &lt;stdlib.h&gt;													//Header-Datei für rand und srand
#include &lt;iostream&gt;													//Header-Datei für &quot;cin&quot; und &quot;cout&quot;
using namespace std;

int main(void)
	{
		int zahl, einlesen;											//Variablen &quot;Zahl&quot; und &quot;Einlesen&quot; als Integer(da Zahlen) deklarieren
		int versuche;												//Versuche ist auch Integer da die Versuche gezählt werden

		srand((unsigned)time(NULL));
		zahl=rand();												//Zahl über Zufallsgenerator erzeugt
		zahl=zahl%1000+1;											//&quot;rand() erzeugt eine Zufallszahl zwischen 2^0 und 2^15, deswegen 
																	//%1000+1; %=Modulo -&gt; keine Kommazahlen; 0 bis 1000

		cout&lt;&lt;&quot;Zufallszahl zwischen 1 und 1000 eingeben&quot;;
		cin&gt;&gt;einlesen;

		for(versuche=0; zahl!=einlesen; versuche++)					//Versuche muss mit =0 initialisiert werden
		{
				if( einlesen&lt;zahl)
					{
						cout&lt;&lt;&quot;Eingebene Zahl ist zu klein!&quot;;
						cout&lt;&lt;&quot;Erneute eingabe&quot;;
						cin&gt;&gt; einlesen;
					}

				else if (einlesen&gt;zahl)
					{
						cout&lt;&lt;&quot;Eingebene Zahl ist zu gross!&quot;;
						cout&lt;&lt;&quot;Erneute eingabe!&quot;;
						cin&gt;&gt; einlesen;
					}

				else (einlesen==zahl)
				{
					if(versuche&lt;10)
					{
						cout&lt;&lt;&quot;Weniger als 10 Versuche, Glueck gehabt/n/n&quot;;
						cout&lt;&lt;&quot;Anzahl der Versuche:/n/n&quot;&lt;&lt;versuche&lt;&lt;endl;
					}
					else if(versuche==10)
					{

							cout&lt;&lt;&quot;Prima, 10 Versuche, sie sind ueberlegt an das Problem herangegangen/n/n&quot;;
					}		cout&lt;&lt;&quot;Anzahl der Versuche:/n/n&quot;&lt;&lt;versuche&lt;&lt;endl;

					else (versuche&gt;10)
					}
						cout&lt;&lt;&quot;Mehr als 10 Versuche, sie haben mehr oder weniger im Nebel gestochert/n/n&quot;;
						cout&lt;&lt;&quot;Anzahl der Versuche:/n/n&quot;&lt;&lt;versuche&lt;&lt;endl;

					}
				}
		}
		return 0;
}
</code></pre>
<p>Nun zu meiner Frage:</p>
<p>Ist die Investition in das Buch &quot;Der C++ Programmierer&quot; gut? Ist das Buch wirklich besser als das Buch &quot;C++ in 21 Tagen&quot;? Was denkt ihr darüber, wenn mein Dozent es mir empfohlen hat? Weil ich dachte, dass das Buch &quot;C++ in 21 Tagen&quot; zum Einstieg in die Programmiersprache C++ für Anfänger gut ist.</p>
<p>Herr Calo habe ich schon eine E-Mail geschrieben, dass ich ihm das Buch abkaufe, das er anscheinend nicht mehr braucht.</p>
<p>Vielen Dank im Voraus für die Antworten.</p>
<p>Gruß</p>
<p>Max</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/302826/bücher-quot-der-c-programmierer-quot-vs-quot-c-in-21-tagen-quot-und-c-standart</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 02:08:08 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/302826.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 28 Apr 2012 07:30:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 07:50:46 GMT]]></title><description><![CDATA[<p>Hallo liebe Gemeinde.</p>
<p>Ich wurde schon von ein paar Leuten, u. A. von SeppJ, daraufhin gewiesen, dass mein Programmierstil nicht dem C++ Standard entspricht.</p>
<p>SeppJ formulierte es so:</p>
<p>&quot;Dein Stil ist übrigens tatsächlich das berüchtigte &quot;C mit cout&quot;, welches in schlechten Büchern und von schlechten Dozenten als C++ verkauft wird.&quot;</p>
<p>Mein Problem ist einfach, dass mir momentan nur das Buch &quot;C++ in 21 Tagen&quot; vorliegt.</p>
<p>Zumindest habe ich folgenden Quellcode hinbekommen:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cmath&gt;
using namespace std;

float Add(float x, float y) // Addition
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Addition!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot; x + y = z &quot; &lt;&lt; endl;
	cout &lt;&lt; endl;
	return (x+y);
}
float Sub(float x, float y) // Subtraktion
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Subtraktion!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot; x - y = z &quot; &lt;&lt; endl;
	cout &lt;&lt; endl;
	return (x-y);
}
float Mul(float x, float y) //Multiplikation
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Multiplikation!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot; x*y = z &quot; &lt;&lt; endl;
	cout &lt;&lt; endl;
	return (x*y);
}
float Div(float x, float y) //Division
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Division!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;x / y = z!&quot; &lt;&lt; endl;
	float z = x/y;
	cout &lt;&lt; endl;
	return (z);
}
float Wur(float x) // Wurzel
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Wurzel!&quot; &lt;&lt; endl;
	return (sqrt(x));
}
float Pot(float x, float y) // Potenz
{
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Funktion Potenz!&quot; &lt;&lt; endl;
	return (pow(x,y));
}

int main()
{
	cout &lt;&lt; &quot;Einsatz von Variablen!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Wie gross waren gleich wieder die einzelnen Datentypen?&quot; &lt;&lt; endl;
	cout &lt;&lt; endl;
	cout &lt;&lt; &quot;Greosse eines int:\t			&quot;&lt;&lt; sizeof(int)			&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines short int:\t\t	&quot;&lt;&lt; sizeof(short int)	&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines long int:\t\t\t	&quot;&lt;&lt; sizeof(long int)	&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines char:\t\t		&quot;&lt;&lt; sizeof(char)		&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines float:\t\t		&quot;&lt;&lt; sizeof(float)		&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines double:\t\t		&quot;&lt;&lt; sizeof(double)		&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Groesse eines bool:\t\t		&quot;&lt;&lt; sizeof(bool)		&lt;&lt;&quot; Bytes.!&quot; &lt;&lt; endl;
	cout &lt;&lt; endl;
	float a,b,c;
	cout &lt;&lt; &quot;Nun wird gerechnet!&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;Zwei Zahlen bitte!&quot; &lt;&lt; endl;
	cin  &gt;&gt; a;
	cin  &gt;&gt; b;
	c=Add(a,b); // Aufruf der Funktion Addition
	cout &lt;&lt; &quot;Nach Addition ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	c=Sub(a,b); // Aufruf der Funktion Subtraktion
	cout &lt;&lt; &quot;Nach Subtraktion ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	c=Mul(a,b); // Aufruf der Funktion Multiplikation
	cout &lt;&lt; &quot;Nach Multiplikation ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	c=Div(a,b); // Aufruf der Funktion Division
	cout &lt;&lt; &quot;Nach Division ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	c=Wur(a); // Aufruf der Funktion Wurzel
	cout &lt;&lt; &quot;Nach Wurzel ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	c=Pot(a,b); // Aufruf der Funktion Potenz
	cout &lt;&lt; &quot;Nach Potenz ist c = &quot; &lt;&lt; c &lt;&lt; endl;
	cout &lt;&lt; endl;

	return 0;
}
</code></pre>
<p>Mein Dozent pflegt folgenden Programmierstil:</p>
<pre><code class="language-cpp">#include &quot;Zufallszahl.h&quot; 
#include &lt;time.h&gt;													//Header-Datei für time bei srand
#include &lt;stdlib.h&gt;													//Header-Datei für rand und srand
#include &lt;iostream&gt;													//Header-Datei für &quot;cin&quot; und &quot;cout&quot;
using namespace std;

int main(void)
	{
		int zahl, einlesen;											//Variablen &quot;Zahl&quot; und &quot;Einlesen&quot; als Integer(da Zahlen) deklarieren
		int versuche;												//Versuche ist auch Integer da die Versuche gezählt werden

		srand((unsigned)time(NULL));
		zahl=rand();												//Zahl über Zufallsgenerator erzeugt
		zahl=zahl%1000+1;											//&quot;rand() erzeugt eine Zufallszahl zwischen 2^0 und 2^15, deswegen 
																	//%1000+1; %=Modulo -&gt; keine Kommazahlen; 0 bis 1000

		cout&lt;&lt;&quot;Zufallszahl zwischen 1 und 1000 eingeben&quot;;
		cin&gt;&gt;einlesen;

		for(versuche=0; zahl!=einlesen; versuche++)					//Versuche muss mit =0 initialisiert werden
		{
				if( einlesen&lt;zahl)
					{
						cout&lt;&lt;&quot;Eingebene Zahl ist zu klein!&quot;;
						cout&lt;&lt;&quot;Erneute eingabe&quot;;
						cin&gt;&gt; einlesen;
					}

				else if (einlesen&gt;zahl)
					{
						cout&lt;&lt;&quot;Eingebene Zahl ist zu gross!&quot;;
						cout&lt;&lt;&quot;Erneute eingabe!&quot;;
						cin&gt;&gt; einlesen;
					}

				else (einlesen==zahl)
				{
					if(versuche&lt;10)
					{
						cout&lt;&lt;&quot;Weniger als 10 Versuche, Glueck gehabt/n/n&quot;;
						cout&lt;&lt;&quot;Anzahl der Versuche:/n/n&quot;&lt;&lt;versuche&lt;&lt;endl;
					}
					else if(versuche==10)
					{

							cout&lt;&lt;&quot;Prima, 10 Versuche, sie sind ueberlegt an das Problem herangegangen/n/n&quot;;
					}		cout&lt;&lt;&quot;Anzahl der Versuche:/n/n&quot;&lt;&lt;versuche&lt;&lt;endl;

					else (versuche&gt;10)
					}
						cout&lt;&lt;&quot;Mehr als 10 Versuche, sie haben mehr oder weniger im Nebel gestochert/n/n&quot;;
						cout&lt;&lt;&quot;Anzahl der Versuche:/n/n&quot;&lt;&lt;versuche&lt;&lt;endl;

					}
				}
		}
		return 0;
}
</code></pre>
<p>Nun zu meiner Frage:</p>
<p>Ist die Investition in das Buch &quot;Der C++ Programmierer&quot; gut? Ist das Buch wirklich besser als das Buch &quot;C++ in 21 Tagen&quot;? Was denkt ihr darüber, wenn mein Dozent es mir empfohlen hat? Weil ich dachte, dass das Buch &quot;C++ in 21 Tagen&quot; zum Einstieg in die Programmiersprache C++ für Anfänger gut ist.</p>
<p>Herr Calo habe ich schon eine E-Mail geschrieben, dass ich ihm das Buch abkaufe, das er anscheinend nicht mehr braucht.</p>
<p>Vielen Dank im Voraus für die Antworten.</p>
<p>Gruß</p>
<p>Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206275</guid><dc:creator><![CDATA[silent_max]]></dc:creator><pubDate>Sat, 28 Apr 2012 07:50:46 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 07:57:51 GMT]]></title><description><![CDATA[<p>Du weisst, das das nur für &quot;deinen&quot; Rechner gilt:</p>
<pre><code class="language-cpp">cout &lt;&lt; &quot;Wie gross waren gleich wieder die einzelnen Datentypen?&quot; &lt;&lt; endl;
</code></pre>
<p>Auf anderen Rechnern können da durchaus andere Ergebnisse heraus kommen.<br />
int kann z.B. 16, 32, 64bit oder exotischen Systemen noch andere Ergebnisse zeigen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206280</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206280</guid><dc:creator><![CDATA[f.-th.]]></dc:creator><pubDate>Sat, 28 Apr 2012 07:57:51 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 08:26:47 GMT]]></title><description><![CDATA[<p>Nachtrag: entweder dir sind Tipfehler beim Quelltext des Dozenten unterlaufen oder hiess die Aufgabe: verbessern sie den Quelltext <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="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206284</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206284</guid><dc:creator><![CDATA[f.-th.]]></dc:creator><pubDate>Sat, 28 Apr 2012 08:26:47 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 08:29:58 GMT]]></title><description><![CDATA[<p>Nein, weder sind mir Tippfehler unterlaufen noch hieß die Aufgabe &quot;Verbessern Sie den Quellcode&quot;.</p>
<p>Damit wollte ich eigentlich &quot;nur&quot; zeigen, wie mein Dozent &quot;drauf ist&quot;, sprich, wie er programmiert.</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206286</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206286</guid><dc:creator><![CDATA[silent_max]]></dc:creator><pubDate>Sat, 28 Apr 2012 08:29:58 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 08:47:10 GMT]]></title><description><![CDATA[<p>Dann versuch doch den Quelltext durch einen Compiler zu bekommen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
<p>Wenn du keinen Compiler findest, schreib mal was du an dem Quelltext ändern willst. Sonst schreib mal das Modell des Compilers.</p>
<p>Zufälle und C++ da findet man ja so Einiges:<br />
<a href="http://www.cplusplus.com/reference/clibrary/cstdlib/rand/" rel="nofollow">http://www.cplusplus.com/reference/clibrary/cstdlib/rand/</a></p>
<p><a href="http://www.c-plusplus.net/forum/172876-full" rel="nofollow">http://www.c-plusplus.net/forum/172876-full</a></p>
<p><a href="http://www.cplusplus.com/reference/algorithm/random_shuffle/" rel="nofollow">http://www.cplusplus.com/reference/algorithm/random_shuffle/</a></p>
<p>nur das als kleine Auswahl.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206291</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206291</guid><dc:creator><![CDATA[f.-th.]]></dc:creator><pubDate>Sat, 28 Apr 2012 08:47:10 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 08:56:52 GMT]]></title><description><![CDATA[<p>Ist folgender Quellcode C++ Standart??</p>
<pre><code class="language-cpp">//Name:		Maximilian Lesti
//Datum:	28.04.2012
//Thema:	Verwendung von Typedef

#include &lt;iostream&gt;
using namespace std;

typedef int I;

int main()
{
	I a,b,c;
	cout &lt;&lt; &quot;Addition von Ganzzahlen!&quot;&lt;&lt; endl;
	cout &lt;&lt; &quot;Zwei Zahlen bitte!&quot; &lt;&lt; endl;
	cin  &gt;&gt; a &gt;&gt; b;
	c=a+b;
	cout &lt;&lt; &quot;c nach Addition: &quot; &lt;&lt; c &lt;&lt; endl;

	return 0;
}
</code></pre>
<p>In der Zwischenzeit versuche ich den anderen Code zu compilieren/debuggen.</p>
<p>Habe gerade eingesehen, dass ich mir doch das Buch &quot;Der C++ Programmierer&quot; von Herrn Calo kaufe. Wird wohl eine gute Investition sein.</p>
<p>Weil bei dem Quellcode &quot;Zufallsraten&quot; fehlt die Header-Datei &quot;Zufallszahl.h&quot;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206292</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206292</guid><dc:creator><![CDATA[silent_max]]></dc:creator><pubDate>Sat, 28 Apr 2012 08:56:52 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 08:53:52 GMT]]></title><description><![CDATA[<p>Sieht erstmal ganz gut aus, abgesehen von ein paar Dingen, die so nicht üblich sind.</p>
<p>P.S.: Es heißt übrigens &quot;Standard&quot;. Was du die ganze Zeit beschreibst, ist die &quot;Art zu stehen&quot;. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206295</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Sat, 28 Apr 2012 08:53:52 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 08:58:04 GMT]]></title><description><![CDATA[<p>314159265358979 schrieb:</p>
<blockquote>
<p>Sieht erstmal ganz gut aus, abgesehen von ein paar Dingen, die so nicht üblich sind.</p>
<p>P.S.: Es heißt übrigens &quot;Standard&quot;. Was du die ganze Zeit beschreibst, ist die &quot;Art zu stehen&quot;. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
</blockquote>
<p>Welche Dinge sind denn nicht so üblich??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206297</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206297</guid><dc:creator><![CDATA[silent_max]]></dc:creator><pubDate>Sat, 28 Apr 2012 08:58:04 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 08:58:11 GMT]]></title><description><![CDATA[<p>f.-th. schrieb:</p>
<blockquote>
<p>Dann versuch doch den Quelltext durch einen Compiler zu bekommen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
</blockquote>
<p>Hast du das gesehen oder hast du auch einfach einen Compiler genommen? Ohne Compiler habe ich es nicht gesehen <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="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206298</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206298</guid><dc:creator><![CDATA[pyhax]]></dc:creator><pubDate>Sat, 28 Apr 2012 08:58:11 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 09:07:43 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

typedef int I; // Dass I ein schlechter Name für ein typedef ist, lass ich mal außen vor, schließlich wolltest du ja nur typedef ausprobieren.

int main()
{
	I a,b,c; // Du brauchst du die Variablen hier doch alle noch nicht.
	cout &lt;&lt; &quot;Addition von Ganzzahlen!&quot;&lt;&lt; endl /* statt endl benutzt mal üblicherweise \n, außer man weiß was endl bedeutet und will auch wirklich endl. */;
	cout &lt;&lt; &quot;Zwei Zahlen bitte!&quot; &lt;&lt; endl;
	cin  &gt;&gt; a &gt;&gt; b;
	c=a+b; // Wozu überhaupt eine Zwischenvariable?
	cout &lt;&lt; &quot;c nach Addition: &quot; &lt;&lt; c &lt;&lt; endl;

	return 0; // main gibt automatisch 0 zurück, wenn kein return vorhanden ist. Das return ist hier unnötig.
}
</code></pre>
<p>Sähe dann so aus:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

typedef int I;

int main()
{
    cout &lt;&lt; &quot;Addition von Ganzzahlen!\n&quot;
         &lt;&lt; &quot;Zwei Zahlen bitte!\n&quot;;

    I a, b;
    cin &gt;&gt; a &gt;&gt; b;

    cout &lt;&lt; &quot;Die Summe der Zahlen lautet: &quot; &lt;&lt; a + b &lt;&lt; '\n';
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2206301</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206301</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Sat, 28 Apr 2012 09:07:43 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 09:20:51 GMT]]></title><description><![CDATA[<p>Hier habt mich überredet, ein besseres Buch zu besorgen.</p>
<p>Ich hoffe nur, dass ich es dann auch kapiere.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206304</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206304</guid><dc:creator><![CDATA[silent_max]]></dc:creator><pubDate>Sat, 28 Apr 2012 09:20:51 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 09:37:41 GMT]]></title><description><![CDATA[<p>Teilweise gesehen - habs dann zu Kontrolle durch einen Compiler geschickt.</p>
<p>Ein oder zwei Sachen hatte ich erwartet aber nicht so viel.</p>
<p>&quot;Zufallszahl.h&quot; brauchst du gar nicht -&gt; auskommentieren oder löschen und gut ist.<br />
Auf den Zufall hab ich nur hingewiesen, weil extra nach C++ gefragt wurde. Da wird zwar der C-Stil ( Header )genutzt, aber an der Stelle läuft das Programm.</p>
<p>Dann kann man noch die Quelltextwiederholungen deutlich reduzieren.<br />
Daraus folgend kann man noch einige Klammer weglassen - muss man aber nicht.<br />
Die Schleife würde ich auch so nicht lassen.</p>
<p>Ihr seht schon da würde ich einiges dran schrauben. Andere Programmierer durchaus andere Teile des Quelltextes.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206305</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206305</guid><dc:creator><![CDATA[f.-th.]]></dc:creator><pubDate>Sat, 28 Apr 2012 09:37:41 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 09:56:10 GMT]]></title><description><![CDATA[<p>Ich muss ehrlich zugeben, dass ich wirklich keine Ahnung davon habe, was Du damit meinst.</p>
<p>Anscheinend hapert es bei mir schon an den Grundlagen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206307</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206307</guid><dc:creator><![CDATA[silent_max]]></dc:creator><pubDate>Sat, 28 Apr 2012 09:56:10 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 10:16:39 GMT]]></title><description><![CDATA[<p>Wie soll man da die Quelltextwiederholung reduzieren (außer z.B manchmal bei else die Bedingung weg lassen, das einleisen aus den if's herausnehmen) ? Das Programm besteht ja größten Teils aus Ausgaben. Man Könnte natürlich so Dinge machen wie:</p>
<pre><code class="language-cpp">std::array&lt;std::string, 3&gt; meldungen = {&quot;Weniger als 10 Versuche...&quot;, &quot;Genau 10 Versuche&quot;, &quot;Mehr als 10 Versuche&quot;};
std::cout &lt;&lt; meldungen[(versuche - 10) / std::abs(versuche-10) + 1] &lt;&lt; std::endl;
</code></pre>
<p>Ob das allerdings guter Stil ist <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /> <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="😃"
    /></p>
<p>EDIT: Ach da wird ja auch noch jedes mal Anzahl der Versuche ausgegeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206313</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206313</guid><dc:creator><![CDATA[pyhax]]></dc:creator><pubDate>Sat, 28 Apr 2012 10:16:39 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 10:52:54 GMT]]></title><description><![CDATA[<p>pyhax schrieb:</p>
<blockquote>
<p>Wie soll man da die Quelltextwiederholung reduzieren (außer z.B manchmal bei else die Bedingung weg lassen, das einleisen aus den if's herausnehmen) ? Das Programm besteht ja größten Teils aus Ausgaben.</p>
</blockquote>
<p>Da lässt sich schon ohne großen Aufwand Einiges rausholen:</p>
<pre><code class="language-cpp">#include &lt;ctime&gt;
#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
using namespace std;

int main()
{
	srand((unsigned)time(NULL));
	int zahl = rand() % 1000 + 1;
	cout&lt;&lt;&quot;Zufallszahl zwischen 1 und 1000 eingeben&quot;;
	int versuche = 1;
	int einlesen;
	while((cin &gt;&gt; einlesen) &amp;&amp; einlesen != zahl)
	{
		cout &lt;&lt; &quot;Eingegebene Zahl ist zu &quot; &lt;&lt; (einlesen &lt; zahl ? &quot;klein&quot; : &quot;gross&quot;) &lt;&lt; &quot;!\nErneute Eingabe!&quot;;
		++versuche;
	}

	if(versuche &lt; 10)
		cout &lt;&lt; &quot;Weniger als 10 Versuche, Glueck gehabt/n/n&quot;;
	else if(versuche == 10)
		cout &lt;&lt; &quot;Prima, 10 Versuche, sie sind ueberlegt an das Problem herangegangen/n/n&quot;;
	else
		cout &lt;&lt; &quot;Mehr als 10 Versuche, sie haben mehr oder weniger im Nebel gestochert/n/n&quot;;

	cout&lt;&lt;&quot;Anzahl der Versuche:/n/n&quot;&lt;&lt;versuche&lt;&lt;endl;
}
</code></pre>
<p>Beachte z.B., dass im Originalcode ein if-Konstrukt stand, dessen else-Teil eigentlich hinter die Schleife gehört hätte. Durch Umstrukturieren hab ich jetzt ne geringere Tiefe und somit besser verständlichen Code.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206324</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206324</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Sat, 28 Apr 2012 10:52:54 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Sat, 28 Apr 2012 11:08:31 GMT]]></title><description><![CDATA[<p>Michael hat das ja schon umgesetzt.<br />
Hier noch eine Variante:</p>
<pre><code class="language-cpp">#include &lt;ctime&gt;                                                    //Header-Datei für time bei srand
#include &lt;cstdlib&gt;                                                    //Header-Datei für rand und srand
#include &lt;iostream&gt;                                                    //Header-Datei für &quot;cin&quot; und &quot;cout&quot;
using namespace std;

int main(void)
{
    int zahl, einlesen;                                            //Variablen &quot;Zahl&quot; und &quot;Einlesen&quot; als Integer(da Zahlen) deklarieren
    int versuche;                                                //Versuche ist auch Integer da die Versuche gezählt werden

    srand((unsigned)time(NULL));
    zahl=rand();                                                //Zahl über Zufallsgenerator erzeugt
    zahl=zahl%1000+1;                                            //&quot;rand() erzeugt eine Zufallszahl zwischen 2^0 und 2^15, deswegen
    //%1000+1; %=Modulo -&gt; keine Kommazahlen; 0 bis 1000

    cout&lt;&lt;&quot;Zufallszahl zwischen 1 und 1000 eingeben&quot;;
    cin&gt;&gt;einlesen;

    for(versuche=0; zahl!=einlesen; versuche++)                    //Versuche muss mit =0 initialisiert werden
    {
        if( einlesen&lt;zahl)
            cout&lt;&lt;&quot;Eingebene Zahl ist zu klein!&quot;;
        else if(einlesen&gt;zahl)
            cout&lt;&lt;&quot;Eingebene Zahl ist zu gross!&quot;;

        cout&lt;&lt;&quot;Erneute eingabe!&quot;;
        cin&gt;&gt; einlesen;
    }

    if(versuche&lt;10)
        cout&lt;&lt;&quot;Weniger als 10 Versuche, Glueck gehabt/n/n&quot;;
    else if(versuche==10)
        cout&lt;&lt;&quot;Prima, 10 Versuche, sie sind ueberlegt an das Problem herangegangen/n/n&quot;;
    else 	// (versuche&gt;10)
        cout&lt;&lt;&quot;Mehr als 10 Versuche, sie haben mehr oder weniger im Nebel gestochert/n/n&quot;;

    cout&lt;&lt;&quot;Anzahl der Versuche:/n/n&quot;&lt;&lt;versuche&lt;&lt;endl;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2206331</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206331</guid><dc:creator><![CDATA[f.-th.]]></dc:creator><pubDate>Sat, 28 Apr 2012 11:08:31 GMT</pubDate></item><item><title><![CDATA[Reply to Bücher &amp;quot;Der C++ Programmierer&amp;quot; VS &amp;quot;C++ in 21 Tagen&amp;quot; und C++ Standart on Mon, 30 Apr 2012 12:29:59 GMT]]></title><description><![CDATA[<p>Wat will man auch auf so etwas reagieren:</p>
<blockquote>
<p>Wer schnell und komprimiert die Grundlagen von C++ lernen will, ohne durch Nebensächliches oder unterhaltende Elemente abgelenkt zu werden, liegt mit diesem Buch richtig. Das Buch vermittelt hierzu das nötige Basiswissen für weiter gehende C++-Programmiervorhaben. Beginnend mit Grundlagen wie Ein- und Ausgabe, dem Umgang mit Variablen und Arrays sowie arithmetischen Operationen über Schleifen und Verzweigungen bis hin zu den berühmt-berüchtigten Zeigern erfährt der Leser auch, was es mit der objektorientierten Programmierung, mit Klassen, Objekten und Methoden auf sich hat. Den Abschluss macht ein Kapitel über die Fehlerbehandlung. Weitergehende Details wie die Programmierung grafischer Oberflächen beispielsweise werden nicht behandelt. Alle Kapitel werden durch Testfragen abgeschlossen. Diese Fragen sind in drei Schwierigkeitsgrade eingeteilt. Positiv ist, dass das Buch vollkommen Betriebssystem-unabhängig abgefasst ist. PC-WELT 2011</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2206936</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2206936</guid><dc:creator><![CDATA[Travor]]></dc:creator><pubDate>Mon, 30 Apr 2012 12:29:59 GMT</pubDate></item></channel></rss>