<?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[Datum erhöhen]]></title><description><![CDATA[<p>Arbeite an einem Programm das Datum ausgeben soll. Dafür habe ich eine Struktur gemacht. Soweit so gut aber ich will das add_day das Tages Datum um 1 erhöht und dann das auch ausgeben werden soll.</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &quot;std_lib_facilities.h&quot;

struct Date{
	int y;  // Jahr
	int m;  // Monat
	int d;  // Tag
};

void add_day(Date&amp; dd,int n) // soll denn Tag um 1 erhöhen
{
	n = 1;
    dd.d = dd.d + n;
}

void day_prog()
{
	Date today;
	today.y = 1978;
	today.m = 6;
	today.d = 25;
	cout &lt;&lt; today.d &lt;&lt; endl;

	Date tomorrow;
	tomorrow.d = today.d;
	tomorrow.d = add_day(today,1); // das ist falsch aber soetwas meine ich
	cout &lt;&lt; tomorrow.d &lt;&lt; endl;

}

int main()
{
    day_prog();

	keep_window_open();
    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/280561/datum-erhöhen</link><generator>RSS for Node</generator><lastBuildDate>Mon, 24 Aug 2026 01:11:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/280561.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 17 Jan 2011 16:51:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 16:51:56 GMT]]></title><description><![CDATA[<p>Arbeite an einem Programm das Datum ausgeben soll. Dafür habe ich eine Struktur gemacht. Soweit so gut aber ich will das add_day das Tages Datum um 1 erhöht und dann das auch ausgeben werden soll.</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &quot;std_lib_facilities.h&quot;

struct Date{
	int y;  // Jahr
	int m;  // Monat
	int d;  // Tag
};

void add_day(Date&amp; dd,int n) // soll denn Tag um 1 erhöhen
{
	n = 1;
    dd.d = dd.d + n;
}

void day_prog()
{
	Date today;
	today.y = 1978;
	today.m = 6;
	today.d = 25;
	cout &lt;&lt; today.d &lt;&lt; endl;

	Date tomorrow;
	tomorrow.d = today.d;
	tomorrow.d = add_day(today,1); // das ist falsch aber soetwas meine ich
	cout &lt;&lt; tomorrow.d &lt;&lt; endl;

}

int main()
{
    day_prog();

	keep_window_open();
    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2007820</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007820</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Mon, 17 Jan 2011 16:51:56 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 17:00:24 GMT]]></title><description><![CDATA[<p>Dafür hat man Rückgabetypen erfunden:</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &quot;std_lib_facilities.h&quot;

struct Date{
    int y;  // Jahr
    int m;  // Monat
    int d;  // Tag
};

Date add_day(Date dd) 
{
    dd.d = dd.d + 1;
    return dd;
}

void day_prog()
{
    Date today;
    today.y = 1978;
    today.m = 6;
    today.d = 25;
    cout &lt;&lt; today.d &lt;&lt; endl;

    Date tomorrow = add_day(today);
    cout &lt;&lt; tomorrow.d &lt;&lt; endl;

}

int main()
{
    day_prog();

    keep_window_open();
    return 0;
}
</code></pre>
<p>Beachte auch die anderen kleinen Änderungen die ich vorgenommen habe und denke darüber nach.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007827</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007827</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 17 Jan 2011 17:00:24 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 17:18:45 GMT]]></title><description><![CDATA[<p>Danke für deine Hilfe, habe wieder etwas dazugelernt. Aber laut der Übung muss es aber so gemacht werden:</p>
<pre><code class="language-cpp">void add_day(Date&amp; dd,int n)
</code></pre>
<p>Für das brauche ich die Lösung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007842</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007842</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Mon, 17 Jan 2011 17:18:45 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 17:28:37 GMT]]></title><description><![CDATA[<p>winux schrieb:</p>
<blockquote>
<p>Danke für deine Hilfe, habe wieder etwas dazugelernt. Aber laut der Übung muss es aber so gemacht werden:</p>
<pre><code class="language-cpp">void add_day(Date&amp; dd,int n)
</code></pre>
<p>Für das brauche ich die Lösung.</p>
</blockquote>
<p>Da ist aber sicherlich gemeint, dass man dd um n erhöhen soll. Guck dir das mal an:</p>
<pre><code class="language-cpp">void add_day(Date&amp; dd,int n) 
{
    dd.d = dd.d + n;
}

void day_prog()
{
    Date today;
    today.y = 1978;
    today.m = 6;
    today.d = 25;
    cout &lt;&lt; today.d &lt;&lt; endl;

    add_day(today,1);
    cout &lt;&lt; today.d &lt;&lt; endl;

}
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /> Denke genau darüber nach, was an deiner Lösung falsch war. Hier steckt eine wichtige Lektion über C++! Und damit meine ich nicht nur die Nutzung des n sondern vor allem die Nutzung der add_day-Funktion an sich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007854</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007854</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 17 Jan 2011 17:28:37 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 17:42:02 GMT]]></title><description><![CDATA[<p>Genau das brauch ich, so musste es gemacht werden. So jetzt kann ich weiter machen mit der Prüfung. Es muss eine Prüfung geschrieben werden die darauf kontrolliert das die Daten stimmen, Nicht das Monat ein 15 wird oder Tag ein -7.</p>
<pre><code class="language-cpp">void init_day(Date&amp; dd,int y,int m,int d)
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2007872</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007872</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Mon, 17 Jan 2011 17:42:02 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 18:07:50 GMT]]></title><description><![CDATA[<p>Jetzt gibt es Probleme mit der Prüfung, wieso bekomme ich nicht die werte die ich erwate?</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &quot;std_lib_facilities.h&quot;

struct Date{
	int y;  // Jahr
	int m;  // Monat
	int d;  // Tag
};

void init_day(Date&amp; dd,int y,int m,int d) //soll prüfen ob das Datum korrekt ist
{
	if(y&lt;1900 || y&gt;2200) error(&quot;Falsches Jahr&quot;);
	if(m&lt;1 || m&gt;12) error(&quot;Falsches Monat&quot;);
	if(d&lt;1 || d&gt;31) error(&quot;Falsches Tag&quot;);
}

void add_day(Date&amp; dd,int n) // soll denn Tag um 1 erhöhen
{
	n = 1;
	dd.d = dd.d + n;
}

void day_prog()
{
	Date today;
	init_day(today,1978,6,25);
	cout &lt;&lt; today.d &lt;&lt; endl;

	Date tomorrow;
	tomorrow.d = today.d;
	add_day(tomorrow,1);
	cout &lt;&lt; tomorrow.d &lt;&lt; endl;

	Date non;
	init_day(non,12,24,2006);
	cout &lt;&lt; non.d &lt;&lt; endl; 
}

int main()
{
    day_prog();

    keep_window_open();
    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2007908</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007908</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Mon, 17 Jan 2011 18:07:50 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 18:23:13 GMT]]></title><description><![CDATA[<p>DAnn schau doch mal nach was <code>Date today;</code> macht ... als tipp ... es ist der Date() Konstruktor .. was du hast keinen Konstruktor? und die Variabeln werden nicht initialisiert? Tjaaa ....... bloss weil du das Ding today nennst, steht da nicht das Datum von heute drin! Achso .. vielleicht solltest du in init_day auch mal das Date initialisieren ... <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=";D"
      alt="😉"
    /></p>
<p>Vielleicht hilft das ja:</p>
<pre><code class="language-cpp">struct Date{
    int year;  // Jahr
    int month;  // Monat
    int day;  // Tag

    Date() : year(0),month(0), day(0) {} // default alle auf 0 ... vieleicht besser alle auf heute?

    void setDate(int y, int m, int d) { setYear(y); setMonth(m); setDay(d);}

    void setYear(int y)  { if (y&gt;1900 &amp;&amp; y&lt;2200) year = y; }
    void setMonth(int m) { if (m&gt;00 &amp;&amp; m&lt;13) month=m; }
    void setDay(int d)   { if (d&gt;0 &amp;&amp; d&lt;32) day=d; } // mhhh ... 30/31,28/29 Tage usw. egal
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2007917</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007917</guid><dc:creator><![CDATA[padreigh]]></dc:creator><pubDate>Mon, 17 Jan 2011 18:23:13 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 19:04:49 GMT]]></title><description><![CDATA[<p>Das mit dem Konstruktor ist gut gemeint, nur darf ich jetzt in dieser Übung keine Konstruktor nutzen. Ich muss mit dem drei werten der Struktur und mit void add_day und void init_day arbeiten.</p>
<pre><code class="language-cpp">void init_day(Date&amp; dd,int y,int m,int d)
{
	if(y&lt;1900 || 2200&lt;m) error(&quot;Falsches Jahr&quot;);
	if(m&lt;1 || 12&lt;m) error(&quot;Falsches Monat&quot;);
	if(d&lt;1 || 31&lt;d) error(&quot;Falsches Tag&quot;);
}
</code></pre>
<p>Doch es kommen nicht die Ergebnisse die man erwartet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007930</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007930</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Mon, 17 Jan 2011 19:04:49 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 19:23:45 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">void init_day(Date&amp; dd,int y,int m,int d) 
{ 
    if(y &lt; 1900 || y &gt; 2200) {error(&quot;Falsches Jahr&quot;);} 
    else if(m &lt; 1 || m &gt; 12) {error(&quot;Falscher Monat&quot;);} 
    else if(d &lt; 1 || d &gt; 31) {error(&quot;Falscher Tag&quot;);}
    else
    {
        dd.d = d;
        dd.m = m;
        dd.y = y;
    }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2007937</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007937</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Mon, 17 Jan 2011 19:23:45 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 19:26:08 GMT]]></title><description><![CDATA[<p>Ok so geht es, aber jetzt mit einem negativen wert fangt es nicht ab.</p>
<pre><code class="language-cpp">Date non;           
init_day(non,789,56,-9);
cout &lt;&lt; non.d &lt;&lt; endl;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2007938</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007938</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Mon, 17 Jan 2011 19:26:08 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 19:26:36 GMT]]></title><description><![CDATA[<p>Das was du machst ist wtf! schau nochmal bei mir ich habe es sekunden vorher editiert... Müdigkeit wins :p</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007940</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007940</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Mon, 17 Jan 2011 19:26:36 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 19:47:59 GMT]]></title><description><![CDATA[<p>Die werte die nicht stimmen werden nicht ausgegeben. Die erste und zweite wert wird ausgegeben weil sie war sind der dritte sollte nicht ausgegeben werden doch ich erhalte eine lange zahl.</p>
<pre><code class="language-cpp">struct Date{
	int y;  // year
	int m;  // month
	int d;  // day
};

void init_day(Date&amp; dd,int y,int m,int d) // die richtigen werte prüfen
{
	if(y&lt;1900 || y&gt;2200) { y = 0;}
	else if(m&lt;1 || m&gt;12) { m = 0;}
	else if(d&lt;1 || d&gt;31) { d = 0;}
	else 
    { 
        dd.y = y; 
        dd.m = m; 
        dd.d = d; 
    } 
}

void add_day(Date&amp; dd,int n) // erhöhe um einen Tag 
{
	n = 1;
	dd.d = dd.d + n;
}

void day_prog()
{
	Date today;
	init_day(today,1978,6,25);
	cout &lt;&lt; today.d &lt;&lt; endl;

	Date tomorrow;
	tomorrow.d = today.d;
	add_day(tomorrow,1);    
	cout &lt;&lt; tomorrow.d &lt;&lt; endl;

	Date non;           // falsche werte 
	init_day(non,789,56,-9);
	cout &lt;&lt; non.d &lt;&lt; endl;
}

int main()
{
    day_prog();

    keep_window_open();
    return 0;
}
</code></pre>
<p>Ich will das die falschen werte nicht ausgegeben werden soll. Mit dem error gab es ein Programm Absturz.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007955</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007955</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Mon, 17 Jan 2011 19:47:59 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 20:01:54 GMT]]></title><description><![CDATA[<p>klar bekommst du bei non falsche Werte, WEIL diese struct noch nie initiliaisert wurde und jeden beliebigen Wert enthalten kann... Weshalb rückgabewerte für Erfolg/Misserfolg sinnvoll wären.</p>
<pre><code class="language-cpp">void init_day(Date&amp; dd,int y,int m,int d) // die richtigen werte prüfen 
{ 
    if(y&lt;1900 || y&gt;2200 || m&lt;1 || m&gt;12 || d&lt;1 || d&gt;31)
    { 
        dd.y = 0; 
        dd.m = 0; 
        dd.d = 0; 
    }
    else 
    { 
        dd.y = y; 
        dd.m = m; 
        dd.d = d; 
    } 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2007957</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007957</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Mon, 17 Jan 2011 20:01:54 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 19:49:34 GMT]]></title><description><![CDATA[<p>Du meinst do etwas wie:</p>
<pre><code class="language-cpp">Date():y(0),m(0),d(0){}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2007960</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007960</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Mon, 17 Jan 2011 19:49:34 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 19:50:43 GMT]]></title><description><![CDATA[<p>winux schrieb:</p>
<blockquote>
<p>Du meinst do etwas wie:</p>
<pre><code class="language-cpp">Date():y(0),m(0),d(0){}
</code></pre>
</blockquote>
<p>Ein Konstruktor wäre natürlich sehr hilfreich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007961</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007961</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Mon, 17 Jan 2011 19:50:43 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 19:50:59 GMT]]></title><description><![CDATA[<p>Jetzt bekomme ich drei werte 0,1,0.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007962</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007962</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Mon, 17 Jan 2011 19:50:59 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 19:53:33 GMT]]></title><description><![CDATA[<p>Was hast du denn nun gemacht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007963</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007963</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Mon, 17 Jan 2011 19:53:33 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 19:54:37 GMT]]></title><description><![CDATA[<p>So geschrieben wie du es gesagt hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007965</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007965</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Mon, 17 Jan 2011 19:54:37 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 20:01:40 GMT]]></title><description><![CDATA[<p>du bekommst die Eins weil du immernoch den Fehler aus 10 posts mitschleppst... In Add_day steht n = 1, welches dort nicht stehen darf. darum auch die 1 in der zweiten Ausgabe.</p>
<p>Edit: Ich hatte einen Tippfehler bei der Datumsabfrage muss natürlich anstelle d&gt;3 -&gt; d&gt;31 lauten. Dann sollte auch alles gehen. sry</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007966</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007966</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Mon, 17 Jan 2011 20:01:40 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 20:03:56 GMT]]></title><description><![CDATA[<p>Danke für den tipp genau da war der Fehler. Aber dort gibt es jetzt einen neuen Fehler wenn man Tag initialisiert und mit n addiert ( so etwas 29 + 3 = 32) dann erhaltet man einen ungültigen Tag wert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007973</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007973</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Mon, 17 Jan 2011 20:03:56 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 20:07:55 GMT]]></title><description><![CDATA[<p>Das ist dann deine nächste Aufgabe, wie muss Add-day aussehen, damit beim hinzufügen von Tagen die Tage/Monate/Jahre Monatsenden immer richtig angezeigt werden inklusive Schaltjahr versteht sich.</p>
<p>Leiste erstmal was und wenn nichts klappt dann frage erneut.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2007976</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2007976</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Mon, 17 Jan 2011 20:07:55 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 21:41:21 GMT]]></title><description><![CDATA[<p>Offtop: Heute scheint der Tag der bekloppten Aufgaben zu sein ... erfind mal wer nen TÜV für c++ Profs...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2008032</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2008032</guid><dc:creator><![CDATA[padreigh]]></dc:creator><pubDate>Mon, 17 Jan 2011 21:41:21 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Mon, 17 Jan 2011 21:45:37 GMT]]></title><description><![CDATA[<p>Pisastudie macht auch vor Professoren keinen Halt!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2008035</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2008035</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Mon, 17 Jan 2011 21:45:37 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Tue, 18 Jan 2011 16:39:32 GMT]]></title><description><![CDATA[<p>Jetzt soll ich die Werte nicht mit cout sondern mit dem ostream&amp; operator ausgeben. Doch der Compiler sagt das: error C2601: 'operator&lt;&lt;': Lokale Funktionsdefinitionen sind unzulässig.</p>
<pre><code class="language-cpp">void day_prog()
{
	Date today;
	init_day(today,1978,6,25);
//	cout &lt;&lt; today.d &lt;&lt; endl;

	Date tomorrow;
	tomorrow.d = today.d;
	add_day(tomorrow,1);   
//	cout &lt;&lt; tomorrow.d &lt;&lt; endl;

	Date non;           
	init_day(non,789,56,-9);
//	cout &lt;&lt; non.d &lt;&lt; endl;

	ostream&amp; operator&lt;&lt;(ostream&amp; os,const Date&amp; today)
	{
		return os &lt;&lt; '(' &lt;&lt; today.d &lt;&lt; ')';
	}
}

int main()
{
    day_prog();

	keep_window_open();
    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2008359</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2008359</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Tue, 18 Jan 2011 16:39:32 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Tue, 18 Jan 2011 16:42:31 GMT]]></title><description><![CDATA[<p>Die Fehlermeldung triffts auf den Punkt. Du kannst keine Funktionen innerhalb anderer Funktionen definieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2008360</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2008360</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Tue, 18 Jan 2011 16:42:31 GMT</pubDate></item><item><title><![CDATA[Reply to Datum erhöhen on Tue, 18 Jan 2011 16:54:12 GMT]]></title><description><![CDATA[<p>Jetzt habe ich es außerhalb der Funktion geschrieben, das Programm startet aber die Konsole zeigt nichts an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2008365</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2008365</guid><dc:creator><![CDATA[winux]]></dc:creator><pubDate>Tue, 18 Jan 2011 16:54:12 GMT</pubDate></item></channel></rss>