<?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[Hilfe bei Binärcodegenerator]]></title><description><![CDATA[<p>Ich versuche ein Konsolenprogramm zu schreiben, dass Dezimalzahlen in Binärzahlen umwandeln kann. Ich weiß bloß nicht wie genau ich das Anfangen soll mit der umrechnung, ich hoffe mir kann wer nen Tipp oder einen Code geben.</p>
<p>So sollte es ablaufen:</p>
<pre><code>Bitte gib die Dez. Zahl ein: 
xxxx
ENTER
Binärzahl: xxxx
</code></pre>
<p>Soll ne ganz einfach Konsolenanwendung sein, würde mich sehr über evtl. Tipps oder Codes freuen.</p>
<p>MfG Sacred</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/205846/hilfe-bei-binärcodegenerator</link><generator>RSS for Node</generator><lastBuildDate>Sat, 10 Oct 2026 01:00:34 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/205846.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 18 Feb 2008 17:08:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hilfe bei Binärcodegenerator on Mon, 18 Feb 2008 17:08:38 GMT]]></title><description><![CDATA[<p>Ich versuche ein Konsolenprogramm zu schreiben, dass Dezimalzahlen in Binärzahlen umwandeln kann. Ich weiß bloß nicht wie genau ich das Anfangen soll mit der umrechnung, ich hoffe mir kann wer nen Tipp oder einen Code geben.</p>
<p>So sollte es ablaufen:</p>
<pre><code>Bitte gib die Dez. Zahl ein: 
xxxx
ENTER
Binärzahl: xxxx
</code></pre>
<p>Soll ne ganz einfach Konsolenanwendung sein, würde mich sehr über evtl. Tipps oder Codes freuen.</p>
<p>MfG Sacred</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1458326</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458326</guid><dc:creator><![CDATA[Sacred]]></dc:creator><pubDate>Mon, 18 Feb 2008 17:08:38 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Binärcodegenerator on Mon, 18 Feb 2008 17:41:43 GMT]]></title><description><![CDATA[<p>wenn mcih ne alles täscht, dann:</p>
<pre><code class="language-cpp">//using namespace std blablabla ^^
int eingabe;
cin &gt;&gt; eingabe;
cout &lt;&lt; hex &lt;&lt; eingabe;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1458343</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458343</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Mon, 18 Feb 2008 17:41:43 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Binärcodegenerator on Mon, 18 Feb 2008 17:46:00 GMT]]></title><description><![CDATA[<p>ich versuhcs mal danke schonmal^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1458345</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458345</guid><dc:creator><![CDATA[Sacred]]></dc:creator><pubDate>Mon, 18 Feb 2008 17:46:00 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Binärcodegenerator on Mon, 18 Feb 2008 18:11:49 GMT]]></title><description><![CDATA[<p>Ja das funktioniert gibt mir die Zahlen aber im Hexadezimalsystem aus ich brauch sie allerdings im Dual-/Binärsystem.</p>
<p>Beispiel:</p>
<pre><code>2730=101010101010
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1458363</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458363</guid><dc:creator><![CDATA[Sacred]]></dc:creator><pubDate>Mon, 18 Feb 2008 18:11:49 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Binärcodegenerator on Mon, 18 Feb 2008 18:37:19 GMT]]></title><description><![CDATA[<p>Let's play with std::bitset (Header: &lt;bitset&gt;)!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1458381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458381</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Mon, 18 Feb 2008 18:37:19 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Binärcodegenerator on Mon, 18 Feb 2008 19:01:23 GMT]]></title><description><![CDATA[<p>(D)Evil schrieb:</p>
<blockquote>
<p>Let's play with std::bitset (Header: &lt;bitset&gt;)!</p>
</blockquote>
<p>Kannste das pls etwas genauer erläutern, ich porgge noch net lange mit cpp. Brauch so ein Proggi für Info Unterricht und bekomms net hin.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1458397</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458397</guid><dc:creator><![CDATA[Sacred]]></dc:creator><pubDate>Mon, 18 Feb 2008 19:01:23 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Binärcodegenerator on Mon, 18 Feb 2008 19:14:09 GMT]]></title><description><![CDATA[<p>Sacred schrieb:</p>
<blockquote>
<p>(D)Evil schrieb:</p>
<blockquote>
<p>Let's play with std::bitset (Header: &lt;bitset&gt;)!</p>
</blockquote>
<p>Kannste das pls etwas genauer erläutern, ich porgge noch net lange mit cpp. Brauch so ein Proggi für Info Unterricht und bekomms net hin.</p>
</blockquote>
<p>google std::bitset?<br />
<a href="http://cplusplus.com/reference/stl/bitset/bitset.html" rel="nofollow">http://cplusplus.com/reference/stl/bitset/bitset.html</a></p>
<p>lernt doch mal lesen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>---</p>
<p>aber ich würde dir empfehlen, dich trotzdem mal mit der umrechnung in andere zahlensysteme (das schema ist jedes mal gleich <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="😉"
    /> zu beschäftigen. das solltest du in jedem schlechten assembler tutorial finden.<br />
denn ich denke nicht, dass sich dein(e) infolehrer(in) mit</p>
<pre><code class="language-cpp">cout &lt;&lt; hex &lt;&lt; blubb;
</code></pre>
<p>begnügen wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1458410</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458410</guid><dc:creator><![CDATA[hey]]></dc:creator><pubDate>Mon, 18 Feb 2008 19:14:09 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Binärcodegenerator on Tue, 19 Feb 2008 21:25:24 GMT]]></title><description><![CDATA[<p>Die Lösung mit std::bitset hat den Nachteil, dass man sich vorher auf die maximale Stellenanzahl festlegen muss. Das ist i.A. unerwünscht.</p>
<p>Ein hier schon mehr als einmal geposteter Klassiker ist:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;iterator&gt;     // ostream_iterator

template&lt; int Base, typename T, typename OutItr &gt;
OutItr decode( T x, OutItr out )
{
    const T digit = x % Base;
    if( (x /= Base) &gt; T() )
        out = decode&lt; Base &gt;( x, out );
    *out = digit;
    return ++out;
}

int main()
{
    using namespace std;
    const int zahl = 2730;
    decode&lt; 2 &gt;( zahl, ostream_iterator&lt; int &gt;( cout &lt;&lt; zahl &lt;&lt; &quot; -&gt; &quot; ) );
    cout &lt;&lt; endl;
    return 0;
}
</code></pre>
<p>Damit erhält man als Ausgabe</p>
<pre><code>2730 -&gt; 101010101010
</code></pre>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459139</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459139</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Tue, 19 Feb 2008 21:25:24 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Binärcodegenerator on Wed, 20 Feb 2008 13:37:16 GMT]]></title><description><![CDATA[<p>Danke Werne habs jezz soweit fertig so sieht der Code aus.</p>
<pre><code class="language-cpp">// Gen.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
//

#include &quot;stdafx.h&quot;

int _tmain(int argc, _TCHAR* argv[])
{
	return 0;
}

#include &lt;iostream&gt;
#include &lt;iterator&gt;     // ostream_iterator

template&lt; int Base, typename T, typename OutItr &gt;
OutItr decode( T x, OutItr out )
{
    const T digit = x % Base;
    if( (x /= Base) &gt; T() )
        out = decode&lt; Base &gt;( x, out );
    *out = digit;
    return ++out;
}

int main()
{
    using namespace std;
	int zahl;
	cout &lt;&lt; &quot;Bitte gib eine Zahl ein:&quot; &lt;&lt; endl;
	cin &gt;&gt; zahl;
	cout &lt;&lt; zahl &lt;&lt; &quot;als Hexadezimalzahl ist: &quot; &lt;&lt; hex &lt;&lt; zahl &lt;&lt; endl;
	decode&lt; 2 &gt;( zahl, ostream_iterator&lt; int &gt;( cout &lt;&lt; zahl &lt;&lt; &quot;als Binaerzahl ist: &quot; ) );
	system(&quot;Pause&quot;);
    return 0;
}
</code></pre>
<p>Thread kann geclosed werden und nochmal Danke an alle.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459449</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459449</guid><dc:creator><![CDATA[Sacred]]></dc:creator><pubDate>Wed, 20 Feb 2008 13:37:16 GMT</pubDate></item></channel></rss>