<?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[Einfache C++ Übung !]]></title><description><![CDATA[<p>Hi,<br />
ich habe folgende Aufgabe,<br />
weiss jedoch nicht wie vorzugehen ist, bzw. was zu machen ist !</p>
<p><a href="http://img339.imageshack.us/img339/8241/ohnetitel1yb6.jpg" rel="nofollow">http://img339.imageshack.us/img339/8241/ohnetitel1yb6.jpg</a></p>
<p>DANKE im Voraus für jede Hilfe !</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/194069/einfache-c-übung</link><generator>RSS for Node</generator><lastBuildDate>Mon, 28 Sep 2026 08:35:54 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/194069.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Oct 2007 13:10:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Einfache C++ Übung ! on Wed, 03 Oct 2007 13:10:37 GMT]]></title><description><![CDATA[<p>Hi,<br />
ich habe folgende Aufgabe,<br />
weiss jedoch nicht wie vorzugehen ist, bzw. was zu machen ist !</p>
<p><a href="http://img339.imageshack.us/img339/8241/ohnetitel1yb6.jpg" rel="nofollow">http://img339.imageshack.us/img339/8241/ohnetitel1yb6.jpg</a></p>
<p>DANKE im Voraus für jede Hilfe !</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377115</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377115</guid><dc:creator><![CDATA[144]]></dc:creator><pubDate>Wed, 03 Oct 2007 13:10:37 GMT</pubDate></item><item><title><![CDATA[Reply to Einfache C++ Übung ! on Wed, 03 Oct 2007 13:26:00 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Wie sehen denn deine bisherigen Versuche/Überlegungen zu diesem Problem aus? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
<p>Gruß, Caipi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377123</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377123</guid><dc:creator><![CDATA[Caipi]]></dc:creator><pubDate>Wed, 03 Oct 2007 13:26:00 GMT</pubDate></item><item><title><![CDATA[Reply to Einfache C++ Übung ! on Wed, 03 Oct 2007 15:04:19 GMT]]></title><description><![CDATA[<p>Das Programm soll so aussehen, dass da Steht:</p>
<pre><code>Geben zie eine zahl ein:
12
der Kreis hat ein Radius von 12, einen Umfang von 2*pi*12, und einen Flächeninhalt von pi*pi*12
...
</code></pre>
<p>nur dass die Werte ausgerechnet sind. Wenn du das nicht schaffst solltest du dir überlegen, ob du nicht vieleicht das Falsche Fach an der Uni belegt hast, noch ist es möglich zu wechseln (oder nicht?).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377154</guid><dc:creator><![CDATA[Krux]]></dc:creator><pubDate>Wed, 03 Oct 2007 15:04:19 GMT</pubDate></item><item><title><![CDATA[Reply to Einfache C++ Übung ! on Wed, 03 Oct 2007 15:58:38 GMT]]></title><description><![CDATA[<p>Mal zum 1. Teil...^^</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cmath&gt;                       // Für Berechnung
#define PI 3.1415926535897932          // Makro für PI
using namespace std;

int main(){
  float r;
  float d;
  float u;
  float a;
  cout&lt;&lt;&quot;*************************************&quot;&lt;&lt;endl;
  cout&lt;&lt;&quot;Geben Sie den Radius des Kreises ein:&quot;&lt;&lt;endl;
  cout&lt;&lt;&quot;*************************************&quot;&lt;&lt;endl;
  cin&gt;&gt;r;          // Eingabe von r
  cout&lt;&lt;endl;
  d = 2*r;         // Berechnung von Durchmesser
  u = d*PI;        // Berechnung von Umfang
  a = 2*PI*r;      // Berechnung von der Fläche
  cout&lt;&lt;&quot;Der Umfang beträgt: &quot;&lt;&lt;u&lt;&lt;endl;  // Ausgabe Umfang
  cout&lt;&lt;&quot;Der Flaecheninhalt des Kreises beträgt: &quot;&lt;&lt;a&lt;&lt;endl;  // Ausgabe Fläche
  cout&lt;&lt;endl;
  system(&quot;PAUSE&quot;);  // evt. wegen Konsole...
  return 0;
}
</code></pre>
<p>Vielleicht so?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377287</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377287</guid><dc:creator><![CDATA[daLord]]></dc:creator><pubDate>Wed, 03 Oct 2007 15:58:38 GMT</pubDate></item><item><title><![CDATA[Reply to Einfache C++ Übung ! on Wed, 03 Oct 2007 16:54:38 GMT]]></title><description><![CDATA[<p>daLord schrieb:</p>
<blockquote>
<p>Mal zum 1. Teil...^^</p>
<pre><code class="language-cpp">#include &lt;cmath&gt;                       // Für Berechnung
</code></pre>
</blockquote>
<p>Wenn du die Funktionen nicht nutzt, brauchst du sie auch nicht einbinden</p>
<p>daLord schrieb:</p>
<blockquote>
<p>Mal zum 1. Teil...^^</p>
<pre><code class="language-cpp">#define PI 3.1415926535897932          // Makro für PI
</code></pre>
</blockquote>
<p>Das ist kein Makro</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377350</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377350</guid><dc:creator><![CDATA[Marko Bold]]></dc:creator><pubDate>Wed, 03 Oct 2007 16:54:38 GMT</pubDate></item><item><title><![CDATA[Reply to Einfache C++ Übung ! on Wed, 03 Oct 2007 17:26:08 GMT]]></title><description><![CDATA[<p>wird aber genauso stur ersetzt!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377371</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377371</guid><dc:creator><![CDATA[mhgfjmg]]></dc:creator><pubDate>Wed, 03 Oct 2007 17:26:08 GMT</pubDate></item><item><title><![CDATA[Reply to Einfache C++ Übung ! on Wed, 03 Oct 2007 17:37:11 GMT]]></title><description><![CDATA[<p>daLord schrieb:</p>
<blockquote>
<pre><code class="language-cpp">d = 2*r;         // Berechnung von Durchmesser 
u = d*PI;        // Berechnung von Umfang 
a = 2*PI*r;      // Berechnung von der Fläche
</code></pre>
</blockquote>
<p>tut mir ja Leid, aber das ist dämlich...<br />
hast du dir das mal angeguckt?</p>
<p>wenn d == 2 * r, dann bedeutet u = d * PI das selbe wie u = 2 * PI * r.<br />
das wiederum bedeutet, dass u == a!</p>
<p>also für u kannst du gleich u = 2 * PI * r schreiben, dann sparst du das d.<br />
und a ist nicht 2 * PI * r, sonder a = PI * PI * r!</p>
<p>programmieren is eben nicht alles xD, Mathe muss auch gelernt sein.</p>
<p>ansonsten is der Code ganz ok.</p>
<p>MfG DrakoXP</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377377</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377377</guid><dc:creator><![CDATA[DrakoXP]]></dc:creator><pubDate>Wed, 03 Oct 2007 17:37:11 GMT</pubDate></item><item><title><![CDATA[Reply to Einfache C++ Übung ! on Wed, 03 Oct 2007 17:50:34 GMT]]></title><description><![CDATA[<blockquote>
<p>a = PI * PI * r!</p>
</blockquote>
<p>a = PI * r²</p>
<blockquote>
<p>programmieren is eben nicht alles xD, Mathe muss auch gelernt sein.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1377386</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377386</guid><dc:creator><![CDATA[Marko Bold]]></dc:creator><pubDate>Wed, 03 Oct 2007 17:50:34 GMT</pubDate></item><item><title><![CDATA[Reply to Einfache C++ Übung ! on Wed, 03 Oct 2007 18:16:44 GMT]]></title><description><![CDATA[<p>Zut mir leid, kann man sich auch mal verschreiben? -.- so ne ² übersieht man schnell...</p>
<pre><code class="language-cpp">/*
 * Dann halt so...
 */
#include &lt;iostream&gt;
#define PI 3.1415926535897932          // ...kein Makro
using namespace std;

int main(){
  float r;
  float d;
  float u;
  float a;
  cout&lt;&lt;&quot;*************************************&quot;&lt;&lt;endl;
  cout&lt;&lt;&quot;Geben Sie den Radius des Kreises ein:&quot;&lt;&lt;endl;
  cout&lt;&lt;&quot;*************************************&quot;&lt;&lt;endl;
  cin&gt;&gt;r;          // Eingabe von r
  cout&lt;&lt;endl;
  d = 2*r;         // Berechnung von Durchmesser
  u = d*PI;        // Berechnung von Umfang
  a = PI*(r*r);      // Berechnung von der Fläche
  cout&lt;&lt;&quot;Der Umfang beträgt: &quot;&lt;&lt;u&lt;&lt;endl;  // Ausgabe Umfang
  cout&lt;&lt;&quot;Der Flaecheninhalt des Kreises beträgt: &quot;&lt;&lt;a&lt;&lt;endl;  // Ausgabe Fläche
  cout&lt;&lt;endl;
  system(&quot;PAUSE&quot;);  // evt. wegen Konsole...
  return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1377411</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377411</guid><dc:creator><![CDATA[daLord]]></dc:creator><pubDate>Wed, 03 Oct 2007 18:16:44 GMT</pubDate></item><item><title><![CDATA[Reply to Einfache C++ Übung ! on Wed, 03 Oct 2007 18:22:45 GMT]]></title><description><![CDATA[<p>daLord schrieb:</p>
<blockquote>
<pre><code class="language-cpp">#define PI 3.1415926535897932          // ...kein Makro
</code></pre>
</blockquote>
<p>pfff...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377419</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377419</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 03 Oct 2007 18:22:45 GMT</pubDate></item><item><title><![CDATA[Reply to Einfache C++ Übung ! on Wed, 03 Oct 2007 21:21:13 GMT]]></title><description><![CDATA[<p>Bin grad am grübeln wie eine &quot;Objektorientierte Version&quot; aussehen würde. Ist gar nicht so einfach finde ich:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

class Shape
{
    public:
    Shape(double save_=0):m_save(save_),PI(3.1415926535){}
    virtual ~Shape(){}
    void input();
    virtual double perimeter() const = 0;
    virtual double area() const = 0;
    inline double get_save() const {return m_save;}

    protected:
    double m_save;
    const double PI;
};

void Shape::input()
{
    cout &lt;&lt; &quot;&gt;&gt;&quot;;
    while(!(cin &gt;&gt; m_save))
    {
        cin.clear(); cin.ignore(numeric_limits&lt;streamsize&gt;::max(), '\n');
        cout &lt;&lt; &quot;ERROR &lt;misentry&gt;\n&quot;;
        cout &lt;&lt; &quot;&gt;&gt;&quot;;
    }
}

class Circle : public Shape
{
    public:
    Circle(double i_save=0):Shape(i_save){}
    ~Circle(){}
    inline double perimeter() const {return m_save*2*PI;} //Umfang
    inline double area() const {return m_save*m_save*2;} //Fläche

    private:
};

class Square : public Shape
{
    public:
    Square(double i_save=0):Shape(i_save){}
    ~Square(){}
    inline double perimeter() const {return 4*m_save;} //Umfang
    inline double area() const {return m_save*m_save;} //Fläche

    private:
};

int main()
{
    Shape *Part1=new Circle;
    Part1-&gt;input();
    cout &lt;&lt; &quot;Kreisumfang: &quot; &lt;&lt; Part1-&gt;perimeter() &lt;&lt; &quot;\n&quot;;
    cout &lt;&lt; &quot;Kreisfl&quot; &lt;&lt; &quot;\x84&quot; &lt;&lt; &quot;che: &quot; &lt;&lt; Part1-&gt;area() &lt;&lt; &quot;\n&quot;;
    Shape *Part2=new Square(Part1-&gt;get_save());
    delete Part1;
    Part1=NULL;
    cout &lt;&lt; &quot;Kantenl&quot; &lt;&lt; &quot;\x84&quot; &lt;&lt; &quot;nge: &quot; &lt;&lt; Part2-&gt;perimeter() &lt;&lt; &quot;\n&quot;;
    cout &lt;&lt; &quot;Quadratsfl&quot; &lt;&lt; &quot;\x84&quot; &lt;&lt; &quot;che: &quot; &lt;&lt; Part2-&gt;area() &lt;&lt; &quot;\n&quot;;
    delete Part2;
    Part2=NULL;

    return 0;
}
</code></pre>
<p>Der Code ist hier natürlich sehr lange, und anderst ist es viel einfacher, aber nur mal so aus reinem Interesse. Vll. ist mein Code ja auch irgendwie unötig zu lange? Aber ich hab halt versucht, so wie ichs in meinem Buch gelernt habe alles schön sauber in Klassen reinzuhaun.....<br />
Passt das so...?<br />
Kann man das jetzt objektorientiert nennen? Gehts noch &quot;objektorientierter&quot;? Was wären eure Vorschläge?</p>
<p>MfG<br />
Stromberg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377490</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377490</guid><dc:creator><![CDATA[Stromberg]]></dc:creator><pubDate>Wed, 03 Oct 2007 21:21:13 GMT</pubDate></item></channel></rss>