<?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[Busfahrplan in C++ Hilfe]]></title><description><![CDATA[<p>Sehr geehrte C++ Profis,</p>
<p>ich benötige Hilfe bei einem Busfahrplan. Er möchte leider nicht so, wie ich es möchte. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
<p>Mein Problem ist es nun:<br />
Bitte geben Sie die Stunden der Startuhrzeit ein: 15 Bitte geben Sie die Minuten der Startuhrzeit ein: 59 Der erste Bus faehrt also um 15:59 Uhr. Bitte geben Sie die Taktzeit in Minuten ein: 90</p>
<p>Als Ausgabe: 15:59<br />
17:29<br />
18:59<br />
20:29<br />
21:59<br />
23:29</p>
<p>Aus cout hinzubekommen, dass Problem ist, dass mein Programm immer nur zu einer Stunde anfängt und die Startuhrzeit in Minuten ignoriert. Ich weiß leider nicht wie ich das am besten implementiere.</p>
<p>Der Busfahrplan soll nur bis 24 Uhr gehen. Für jede Stunde soll eine neue Zeile gemacht werden (Dies funktioniert auch).</p>
<p>Kann mir jemand helfen, damit ich die Ausgabe so hin bekomme?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

int main() {

	int startzeit_stunden;
	int startzeit_minuten = 0;
	int takt = 0;
	do {
		cout &lt;&lt; &quot;Bitte geben Sie die Stunden der Startuhrzeit ein:&quot;;
		cin &gt;&gt; startzeit_stunden;

	} while (startzeit_stunden &lt; 0);

	do {
		cout &lt;&lt; &quot;Bitte geben Sie die Minuten der Startuhrzeit ein:&quot;;
		cin &gt;&gt; startzeit_minuten;

	} while (startzeit_minuten &gt; 59);

	cout &lt;&lt; &quot;Der erste Bus faehrt also um &quot; &lt;&lt; startzeit_stunden &lt;&lt; &quot;:&quot; &lt;&lt; startzeit_minuten &lt;&lt; &quot; Uhr. &quot; &lt;&lt; endl;

	do {
		cout &lt;&lt; &quot;Bitte geben Sie die Taktzeit in Minuten ein:&quot;;
		cin &gt;&gt; takt;

	} while (takt &gt; 180 || takt == 0);

	int cnt = startzeit_stunden;

	for (int i = startzeit_stunden; i&lt;24; ++i) {

		while ((cnt += takt)  &lt; 59) {

				cout &lt;&lt; i &lt;&lt; &quot;:&quot; &lt;&lt; cnt &lt;&lt; &quot; &quot;;

		}
		cout &lt;&lt; endl;
		cnt = cnt % takt;
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/340271/busfahrplan-in-c-hilfe</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 05:38:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/340271.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 Oct 2016 19:45:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Busfahrplan in C++ Hilfe on Fri, 28 Oct 2016 19:45:29 GMT]]></title><description><![CDATA[<p>Sehr geehrte C++ Profis,</p>
<p>ich benötige Hilfe bei einem Busfahrplan. Er möchte leider nicht so, wie ich es möchte. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
<p>Mein Problem ist es nun:<br />
Bitte geben Sie die Stunden der Startuhrzeit ein: 15 Bitte geben Sie die Minuten der Startuhrzeit ein: 59 Der erste Bus faehrt also um 15:59 Uhr. Bitte geben Sie die Taktzeit in Minuten ein: 90</p>
<p>Als Ausgabe: 15:59<br />
17:29<br />
18:59<br />
20:29<br />
21:59<br />
23:29</p>
<p>Aus cout hinzubekommen, dass Problem ist, dass mein Programm immer nur zu einer Stunde anfängt und die Startuhrzeit in Minuten ignoriert. Ich weiß leider nicht wie ich das am besten implementiere.</p>
<p>Der Busfahrplan soll nur bis 24 Uhr gehen. Für jede Stunde soll eine neue Zeile gemacht werden (Dies funktioniert auch).</p>
<p>Kann mir jemand helfen, damit ich die Ausgabe so hin bekomme?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

int main() {

	int startzeit_stunden;
	int startzeit_minuten = 0;
	int takt = 0;
	do {
		cout &lt;&lt; &quot;Bitte geben Sie die Stunden der Startuhrzeit ein:&quot;;
		cin &gt;&gt; startzeit_stunden;

	} while (startzeit_stunden &lt; 0);

	do {
		cout &lt;&lt; &quot;Bitte geben Sie die Minuten der Startuhrzeit ein:&quot;;
		cin &gt;&gt; startzeit_minuten;

	} while (startzeit_minuten &gt; 59);

	cout &lt;&lt; &quot;Der erste Bus faehrt also um &quot; &lt;&lt; startzeit_stunden &lt;&lt; &quot;:&quot; &lt;&lt; startzeit_minuten &lt;&lt; &quot; Uhr. &quot; &lt;&lt; endl;

	do {
		cout &lt;&lt; &quot;Bitte geben Sie die Taktzeit in Minuten ein:&quot;;
		cin &gt;&gt; takt;

	} while (takt &gt; 180 || takt == 0);

	int cnt = startzeit_stunden;

	for (int i = startzeit_stunden; i&lt;24; ++i) {

		while ((cnt += takt)  &lt; 59) {

				cout &lt;&lt; i &lt;&lt; &quot;:&quot; &lt;&lt; cnt &lt;&lt; &quot; &quot;;

		}
		cout &lt;&lt; endl;
		cnt = cnt % takt;
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2513277</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513277</guid><dc:creator><![CDATA[ShwanMe]]></dc:creator><pubDate>Fri, 28 Oct 2016 19:45:29 GMT</pubDate></item><item><title><![CDATA[Reply to Busfahrplan in C++ Hilfe on Sat, 29 Oct 2016 00:36:40 GMT]]></title><description><![CDATA[<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

int main() {

    int startzeit_stunden;
    int startzeit_minuten = 0;
    int takt = 0;
    do {
        cout &lt;&lt; &quot;Bitte geben Sie die Stunden der Startuhrzeit ein:&quot;;
        cin &gt;&gt; startzeit_stunden;

    } while (startzeit_stunden &lt; 0);

    do {
        cout &lt;&lt; &quot;Bitte geben Sie die Minuten der Startuhrzeit ein:&quot;;
        cin &gt;&gt; startzeit_minuten;

    } while (startzeit_minuten &gt; 59);

    cout &lt;&lt; &quot;Der erste Bus faehrt also um &quot; &lt;&lt; startzeit_stunden &lt;&lt; &quot;:&quot; &lt;&lt; startzeit_minuten &lt;&lt; &quot; Uhr. &quot; &lt;&lt; endl;

    do {
        cout &lt;&lt; &quot;Bitte geben Sie die Taktzeit in Minuten ein:&quot;;
        cin &gt;&gt; takt;

    } while (takt &gt; 180 || takt == 0);

    while(startzeit_stunden &lt; 24)
    {
      cout &lt;&lt; startzeit_stunden &lt;&lt; &quot;:&quot; &lt;&lt; startzeit_minuten &lt;&lt; '\n';
      startzeit_minuten += takt;
      startzeit_stunden += startzeit_minuten / 60;
      startzeit_minuten %= 60;
    }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2513289</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513289</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Sat, 29 Oct 2016 00:36:40 GMT</pubDate></item><item><title><![CDATA[Reply to Busfahrplan in C++ Hilfe on Sat, 29 Oct 2016 09:38:25 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>leider funktioniert nun folgendes nicht mehr: Für jede Stunde soll eine neue Zeile gemacht werden</p>
<p>Wie kann ich das realisieren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513309</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513309</guid><dc:creator><![CDATA[ShawnMe]]></dc:creator><pubDate>Sat, 29 Oct 2016 09:38:25 GMT</pubDate></item><item><title><![CDATA[Reply to Busfahrplan in C++ Hilfe on Sat, 29 Oct 2016 09:55:25 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>habe es nun hinbekommen.<br />
Erhalte folgende Fehlermeldung:</p>
<p>equality assertion failed</p>
<p>- Expected: Bitte geben Sie die Stunden der Startuhrzeit ein: Bitte geben Sie d<br />
ie Minuten der Startuhrzeit ein: Der erste Bus faehrt also um 15:59 Uhr.<br />
Bitte geben Sie die Taktzeit in Minuten ein: 15:59<br />
17:29<br />
18:59<br />
20:29<br />
21:59<br />
23:29</p>
<p>- Actual : Bitte geben Sie die Stunden der Startuhrzeit ein: Bitte geben Sie d<br />
ie Minuten der Startuhrzeit ein: Der erste Bus faehrt also um 15:59 Uhr.<br />
Bitte geben Sie die Taktzeit in Minuten ein: 15:59<br />
17:29<br />
18:59<br />
20:29<br />
21:59<br />
23:29</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

int main() {

	int startzeit_stunden;
	int startzeit_minuten = 0;
	int takt = 0;
	do {
		cout &lt;&lt; &quot;Bitte geben Sie die Stunden der Startuhrzeit ein: &quot;;
		cin &gt;&gt; startzeit_stunden;

	} while (startzeit_stunden &lt; 0);

	do {
		cout &lt;&lt; &quot;Bitte geben Sie die Minuten der Startuhrzeit ein: &quot;;
		cin &gt;&gt; startzeit_minuten;

	} while (startzeit_minuten &gt; 59);

	cout &lt;&lt; &quot;Der erste Bus faehrt also um &quot; &lt;&lt; startzeit_stunden &lt;&lt; &quot;:&quot; &lt;&lt; startzeit_minuten &lt;&lt; &quot; Uhr. &quot; &lt;&lt; endl;

	do {
		cout &lt;&lt; &quot;Bitte geben Sie die Taktzeit in Minuten ein: &quot;;
		cin &gt;&gt; takt;

	} while (takt &gt; 180 || takt == 0);

	int z = 0;
	while (startzeit_stunden &lt; 24)
	{

		z = startzeit_stunden;
		cout &lt;&lt; startzeit_stunden &lt;&lt; &quot;:&quot; &lt;&lt; startzeit_minuten &lt;&lt; &quot; &quot;;
		startzeit_minuten += takt;
		startzeit_stunden += startzeit_minuten / 60;
		startzeit_minuten %= 60;
		if (z != startzeit_stunden) {
			cout &lt;&lt; endl;
		}
	}
	system(&quot;pause&quot;);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2513312</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513312</guid><dc:creator><![CDATA[ShawnMe]]></dc:creator><pubDate>Sat, 29 Oct 2016 09:55:25 GMT</pubDate></item><item><title><![CDATA[Reply to Busfahrplan in C++ Hilfe on Sat, 29 Oct 2016 10:00:41 GMT]]></title><description><![CDATA[<p>Wenn man irgendein Testsystem damit füttert, ist system(&quot;pause&quot;) bestimmt doof.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513313</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513313</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Sat, 29 Oct 2016 10:00:41 GMT</pubDate></item><item><title><![CDATA[Reply to Busfahrplan in C++ Hilfe on Sat, 29 Oct 2016 10:03:31 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>getestet, behebt den Fehler nicht. Das Testsystem hat nichts gegen system pause. Evnetuell gegen eine Bedingung.. jemand eine Idee?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513314</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513314</guid><dc:creator><![CDATA[ShawnMe]]></dc:creator><pubDate>Sat, 29 Oct 2016 10:03:31 GMT</pubDate></item><item><title><![CDATA[Reply to Busfahrplan in C++ Hilfe on Sat, 29 Oct 2016 11:47:30 GMT]]></title><description><![CDATA[<p>ShawnMe schrieb:</p>
<blockquote>
<p>Hallo,</p>
<p>leider funktioniert nun folgendes nicht mehr: Für jede Stunde soll eine neue Zeile gemacht werden</p>
<p>Wie kann ich das realisieren?</p>
</blockquote>
<p>Ich verstehe Deine Anforderung nicht. Jede Abfahrtszeit wird doch in einer neuen Zeile ausgegeben?!<br />
Und was meinst Du mit &quot;leider funktioniert nun folgendes <strong>nicht mehr</strong>&quot;?<br />
In Deinem Code hat gar nichts funktioniert!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513323</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513323</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Sat, 29 Oct 2016 11:47:30 GMT</pubDate></item><item><title><![CDATA[Reply to Busfahrplan in C++ Hilfe on Sat, 29 Oct 2016 13:47:38 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Es funktioniert nun alles.</p>
<p>Es taucht im testsystem nur der Fehler auf</p>
<p>equality assertion failed</p>
<p>Jemand eine idee ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513332</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513332</guid><dc:creator><![CDATA[ShawnMe]]></dc:creator><pubDate>Sat, 29 Oct 2016 13:47:38 GMT</pubDate></item><item><title><![CDATA[Reply to Busfahrplan in C++ Hilfe on Thu, 03 Nov 2016 18:05:02 GMT]]></title><description><![CDATA[<p>Die Taktzeit soll vermutlich auch nicht negativ sein oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2514014</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2514014</guid><dc:creator><![CDATA[LeBoyce]]></dc:creator><pubDate>Thu, 03 Nov 2016 18:05:02 GMT</pubDate></item><item><title><![CDATA[Reply to Busfahrplan in C++ Hilfe on Thu, 03 Nov 2016 18:19:16 GMT]]></title><description><![CDATA[<p>LeBoyce schrieb:</p>
<blockquote>
<p>Die Taktzeit soll vermutlich auch nicht negativ sein oder?</p>
</blockquote>
<p>Genau so sollte die Stunden Anzahl nicht größer als 23 sein und die Minuten Anzahl nicht negativ oder gleich null ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2514019</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2514019</guid><dc:creator><![CDATA[i++]]></dc:creator><pubDate>Thu, 03 Nov 2016 18:19:16 GMT</pubDate></item><item><title><![CDATA[Reply to Busfahrplan in C++ Hilfe on Thu, 03 Nov 2016 20:17:25 GMT]]></title><description><![CDATA[<p>Die volle Stunde hat auf meiner Digitaluhr aber null Minuten. <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/2514025</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2514025</guid><dc:creator><![CDATA[volle_stunde]]></dc:creator><pubDate>Thu, 03 Nov 2016 20:17:25 GMT</pubDate></item></channel></rss>