<?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[Anfängerfrage zur Eingabe]]></title><description><![CDATA[<p>Guten Abend!<br />
Ich habe das Problem, wenn ich eine Eingabe habe, die durch ein Leerzeichen getrennt wird, das die nächste Eingabe einfach übersprungen wird.<br />
Also z.b.:<br />
cout &lt;&lt; &quot;Gebe Straße ein&quot;;<br />
cin &gt;&gt; straße;<br />
cout &lt;&lt; &quot;Gebe Hausnummer ein&quot;;<br />
cin &gt;&gt; hnr;</p>
<p>Eingabe bei Straße: Am Teilchensee</p>
<p>So wird bei straße &quot;Am&quot; gespeichert und bei hnr &quot;Teilchensee&quot; gespeichert.<br />
Hat jemand eine Lösung dazu?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/201189/anfängerfrage-zur-eingabe</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 17:49:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/201189.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 25 Dec 2007 22:50:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 22:50:58 GMT]]></title><description><![CDATA[<p>Guten Abend!<br />
Ich habe das Problem, wenn ich eine Eingabe habe, die durch ein Leerzeichen getrennt wird, das die nächste Eingabe einfach übersprungen wird.<br />
Also z.b.:<br />
cout &lt;&lt; &quot;Gebe Straße ein&quot;;<br />
cin &gt;&gt; straße;<br />
cout &lt;&lt; &quot;Gebe Hausnummer ein&quot;;<br />
cin &gt;&gt; hnr;</p>
<p>Eingabe bei Straße: Am Teilchensee</p>
<p>So wird bei straße &quot;Am&quot; gespeichert und bei hnr &quot;Teilchensee&quot; gespeichert.<br />
Hat jemand eine Lösung dazu?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426135</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426135</guid><dc:creator><![CDATA[Scale]]></dc:creator><pubDate>Tue, 25 Dec 2007 22:50:58 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 22:57:05 GMT]]></title><description><![CDATA[<p>Verwende <a href="http://www.cppreference.com/cppstring/getline.html" rel="nofollow">getline</a>.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426136</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426136</guid><dc:creator><![CDATA[OhneName]]></dc:creator><pubDate>Tue, 25 Dec 2007 22:57:05 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 23:11:08 GMT]]></title><description><![CDATA[<p>hmm irgendwie habe ich es nicht hinbekommen, mit getline....</p>
<p>mein code:</p>
<p>string s;<br />
cout &lt;&lt; &quot;\nStrasse eintragen: &quot;;<br />
getline (cin,s);<br />
cout &lt;&lt; s;</p>
<p>richtig so????</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426141</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426141</guid><dc:creator><![CDATA[Scale]]></dc:creator><pubDate>Tue, 25 Dec 2007 23:11:08 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 23:15:51 GMT]]></title><description><![CDATA[<p>Jop müsste gehen, aber wenn er die Konsole schliessen sollte ohne dir vorher dei Ausgabe angezeigt zu haben, dann solltest du doch besser noch ein cin.sync( ); nach getline schreiben.</p>
<p>Gruß Tobi.</p>
<p>Frohen 2. Weinachtstag :xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426143</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426143</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Tue, 25 Dec 2007 23:15:51 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 23:15:51 GMT]]></title><description><![CDATA[<p>Wie &quot;nicht hinbekommen&quot;? Bei mir funktioniert das bestens.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;

int main()
{
    std::string street;
    std::cout &lt;&lt; &quot;Street: &quot;;
    std::getline(std::cin, street);
    std::cout &lt;&lt; street &lt;&lt; std::endl;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1426142</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426142</guid><dc:creator><![CDATA[OhneName]]></dc:creator><pubDate>Tue, 25 Dec 2007 23:15:51 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 23:21:30 GMT]]></title><description><![CDATA[<p>danke erstmal für die Antwort <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="🙂"
    /><br />
aber bei der Ausführung wird nun einfach die Eingabe von der Straße übersprungen,<br />
obwohl ich es genau probiert habe ...<br />
hatte auch mal cin.getline probiert, genau das gleiche problem ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426146</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426146</guid><dc:creator><![CDATA[Scale]]></dc:creator><pubDate>Tue, 25 Dec 2007 23:21:30 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 23:26:42 GMT]]></title><description><![CDATA[<p>Der von mir gepostete Quelltext funktioniert in der Form wie er ist. Der Fehler bei dir muss also davor liegen. Leider hab ich auch dieses Jahr wieder nicht die gewünschte Glaskugel geschenkt bekommen, weshalb ich dich bitten muss ein wenig mehr Code rauszurücken.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426147</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426147</guid><dc:creator><![CDATA[OhneName]]></dc:creator><pubDate>Tue, 25 Dec 2007 23:26:42 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 23:29:52 GMT]]></title><description><![CDATA[<p>hehe <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="🙂"
    /> wollte grade schonmal meine code posten<br />
danke nochmal!</p>
<pre><code class="language-cpp">int add()
{
    cout &lt;&lt; &quot;Eintrag hinzufuegen!\n\n&quot;;  
    cout &lt;&lt; &quot;\nVorname eintragen: &quot;;
    cin &gt;&gt; vname;
    cout &lt;&lt; &quot;\nNachname eintragen: &quot;;
    cin &gt;&gt; nname;
    string strasse;
    cout &lt;&lt; &quot;\nStrasse eintragen: &quot;;
    getline(cin, strasse);
    cout &lt;&lt; &quot;\nHausnummer eintragen: &quot;;
    cin &gt;&gt; hnr;
    cout &lt;&lt; &quot;\nStadt eintragen: &quot;;
    cin &gt;&gt; stadt;
    cout &lt;&lt; &quot;\nPostleitzahl eintragen: &quot;;
    cin &gt;&gt; plz;   
    std::ofstream outfile;
    outfile.open(&quot;test.txt&quot;, ios::app);
    outfile &lt;&lt; &quot;Eintrag &quot; &lt;&lt; y &lt;&lt; std::endl;
    outfile &lt;&lt; &quot;Vorname: &quot; &lt;&lt; vname &lt;&lt; std::endl;
    outfile &lt;&lt; &quot;Nachname: &quot; &lt;&lt; nname &lt;&lt; std::endl;
    outfile &lt;&lt; &quot;Strasse: &quot; &lt;&lt; strasse &lt;&lt; std::endl;
    outfile &lt;&lt; &quot;Hausnummer: &quot; &lt;&lt; hnr &lt;&lt; std::endl;
    outfile &lt;&lt; &quot;Stadt: &quot; &lt;&lt; stadt &lt;&lt; std::endl;
    outfile &lt;&lt; &quot;Postleitzahl: &quot; &lt;&lt; plz &lt;&lt; std::endl;  
    outfile &lt;&lt; &quot;\n&quot;;                  
    outfile.close();
    return menu();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1426148</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426148</guid><dc:creator><![CDATA[Scale]]></dc:creator><pubDate>Tue, 25 Dec 2007 23:29:52 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 23:51:13 GMT]]></title><description><![CDATA[<p>das komische ist, wenn ich die vorherige eingabe, auch einfach mal mit einer Eingabe von &quot;Test Test&quot; speise, kommt als ergebnis:<br />
Nachname: Test<br />
Strasse: Test</p>
<p>Obwohl ich nichtmal für Strasse etwas eingeben konnte ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426155</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426155</guid><dc:creator><![CDATA[Scale]]></dc:creator><pubDate>Tue, 25 Dec 2007 23:51:13 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 23:52:03 GMT]]></title><description><![CDATA[<p>Du musst nach jedem cin die übrigen Zeichen aus dem Eingabepuffer entfernen.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;limits&gt;

std::istream&amp; clear(std::istream&amp; in)
{
    in.clear();
    in.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), '\n');
    return in;
}

int main()
{
    std::string vname, nname, strasse, hnr, stadt, plz;

    std::cout &lt;&lt; &quot;Vorname: &quot;;
    std::cin &gt;&gt; vname;
    clear(std::cin);

    std::cout &lt;&lt; &quot;Nachname: &quot;;
    std::cin &gt;&gt; nname;
    clear(std::cin);

    std::cout &lt;&lt; &quot;Strasse: &quot;;
    std::getline(std::cin, strasse);

    std::cout &lt;&lt; &quot;Hausnummer: &quot;;
    std::cin &gt;&gt; hnr;
    clear(std::cin);

    std::cout &lt;&lt; &quot;Stadt: &quot;;
    std::cin &gt;&gt; stadt;
    clear(std::cin);

    std::cout &lt;&lt; &quot;Postleitzahl: &quot;;
    std::cin &gt;&gt; plz;
    clear(std::cin);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1426156</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426156</guid><dc:creator><![CDATA[OhneName]]></dc:creator><pubDate>Tue, 25 Dec 2007 23:52:03 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 23:54:14 GMT]]></title><description><![CDATA[<p>nen cin.sync( ) sollte auch nicht fehlen nach jeder Texteingabe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426157</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426157</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Tue, 25 Dec 2007 23:54:14 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Tue, 25 Dec 2007 23:56:17 GMT]]></title><description><![CDATA[<p>vielen Danke <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="🙂"
    /><br />
jetzt funktioniert es! Da wäre ich aber nicht wirklich von alleine draufgekommen ^^. Hat mir sehr weitergeholfen, danke nochmal und noch ein frohes Fest!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426158</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426158</guid><dc:creator><![CDATA[Scale]]></dc:creator><pubDate>Tue, 25 Dec 2007 23:56:17 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Wed, 26 Dec 2007 00:01:34 GMT]]></title><description><![CDATA[<p>T0bi schrieb:</p>
<blockquote>
<p>nen cin.sync( ) sollte auch nicht fehlen nach jeder Texteingabe.</p>
</blockquote>
<p>Was macht sync() denn, was cin.ignore(numeric_limits&lt;streamsize&gt;::max(), '\n') nicht macht? Ich kann sync auch in keiner C++-Referenz finden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426159</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426159</guid><dc:creator><![CDATA[OhneName]]></dc:creator><pubDate>Wed, 26 Dec 2007 00:01:34 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zur Eingabe on Wed, 26 Dec 2007 08:31:56 GMT]]></title><description><![CDATA[<p><a href="http://www.resourcecode.de/showtopic.php?threadid=1812" rel="nofollow">http://www.resourcecode.de/showtopic.php?threadid=1812</a></p>
<p>Gruß Tobi.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426202</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426202</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Wed, 26 Dec 2007 08:31:56 GMT</pubDate></item></channel></rss>