<?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[struct und cin.get...hilfe!!!]]></title><description><![CDATA[<p>also folgende struktur:</p>
<p>struct geburtstage{<br />
char name[50];<br />
int tag;<br />
int monat;<br />
int jahr;<br />
};</p>
<p>Man wählt nun zwischen einer Auswahl von Eingeben, Ausgeben und Ende.<br />
Für die Eingabe ist folgende Funktion zuständig:</p>
<p>void input(int&amp; zaehler, struct geburtstage* b) {<br />
cout&lt;&lt;&quot;Name : &quot;;<br />
cin&gt;&gt;b[zaehler].name;<br />
cout&lt;&lt;&quot;Tag : &quot;;<br />
cin&gt;&gt;b[zaehler].tag;<br />
cout&lt;&lt;&quot;Monat: &quot;;<br />
cin&gt;&gt;b[zaehler].monat;<br />
cout&lt;&lt;&quot;Jahr : &quot;;<br />
cin&gt;&gt;b[zaehler].jahr;<br />
zaehler++;<br />
}</p>
<p>wenn ich jetz nicht</p>
<p>cin&gt;&gt;b[zaehler].name;</p>
<p>sondern</p>
<p>cin.getline(b[zaehler].name, sizeof(b[zaehler].name));</p>
<p>schreibe.</p>
<p>Jedoch habe ich dann beim ausführen des Programmes keine möglichkeit den Namen einzugeben sonder ich werde aufgefordert gleich den Tag einzugeben. Was ist an meiner Lösung falsch????</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/200954/struct-und-cin-get-hilfe</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 11:42:15 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/200954.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Dec 2007 23:33:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to struct und cin.get...hilfe!!! on Fri, 21 Dec 2007 23:33:55 GMT]]></title><description><![CDATA[<p>also folgende struktur:</p>
<p>struct geburtstage{<br />
char name[50];<br />
int tag;<br />
int monat;<br />
int jahr;<br />
};</p>
<p>Man wählt nun zwischen einer Auswahl von Eingeben, Ausgeben und Ende.<br />
Für die Eingabe ist folgende Funktion zuständig:</p>
<p>void input(int&amp; zaehler, struct geburtstage* b) {<br />
cout&lt;&lt;&quot;Name : &quot;;<br />
cin&gt;&gt;b[zaehler].name;<br />
cout&lt;&lt;&quot;Tag : &quot;;<br />
cin&gt;&gt;b[zaehler].tag;<br />
cout&lt;&lt;&quot;Monat: &quot;;<br />
cin&gt;&gt;b[zaehler].monat;<br />
cout&lt;&lt;&quot;Jahr : &quot;;<br />
cin&gt;&gt;b[zaehler].jahr;<br />
zaehler++;<br />
}</p>
<p>wenn ich jetz nicht</p>
<p>cin&gt;&gt;b[zaehler].name;</p>
<p>sondern</p>
<p>cin.getline(b[zaehler].name, sizeof(b[zaehler].name));</p>
<p>schreibe.</p>
<p>Jedoch habe ich dann beim ausführen des Programmes keine möglichkeit den Namen einzugeben sonder ich werde aufgefordert gleich den Tag einzugeben. Was ist an meiner Lösung falsch????</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1424661</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1424661</guid><dc:creator><![CDATA[BOSS]]></dc:creator><pubDate>Fri, 21 Dec 2007 23:33:55 GMT</pubDate></item><item><title><![CDATA[Reply to struct und cin.get...hilfe!!! on Sat, 22 Dec 2007 03:15:10 GMT]]></title><description><![CDATA[<p>Hm, setz mal vor das Einlesen via std::cin ein:</p>
<pre><code class="language-cpp">cin.sync();
cin.clear();
</code></pre>
<p>Um den Eingabepuffer zu leeren, vllt. ist da ja noch wat drin <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/1424700</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1424700</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sat, 22 Dec 2007 03:15:10 GMT</pubDate></item><item><title><![CDATA[Reply to struct und cin.get...hilfe!!! on Sat, 22 Dec 2007 10:30:58 GMT]]></title><description><![CDATA[<p>okay danke so geht es. aber kann mir vll einer erklären wieso es ohne diese beiden funktionen nicht ging???<br />
immerhin kommt im programm vorher noch keine eingabe vom benutzer sodass der puffer noch leer ist. wieso überspringt er mein cin.getline() ohne cin.sync() und cin.clear() einfach so????</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1424738</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1424738</guid><dc:creator><![CDATA[BOSS]]></dc:creator><pubDate>Sat, 22 Dec 2007 10:30:58 GMT</pubDate></item><item><title><![CDATA[Reply to struct und cin.get...hilfe!!! on Sat, 22 Dec 2007 12:51:55 GMT]]></title><description><![CDATA[<p>Hast du vorher schon eine Eingabe per std::cin getätigt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1424786</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1424786</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sat, 22 Dec 2007 12:51:55 GMT</pubDate></item><item><title><![CDATA[Reply to struct und cin.get...hilfe!!! on Sun, 23 Dec 2007 13:12:22 GMT]]></title><description><![CDATA[<p>ja stimmt jetz seh ich es..hatte ich übersehen ich habe vorher schon eine eingabe mit cin wobei der benutzer dabei eine zahl von 1-4 eingeben muss. aber warum wirkt sich das so fatal auf cin.getline() aus??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1425165</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1425165</guid><dc:creator><![CDATA[BOSS]]></dc:creator><pubDate>Sun, 23 Dec 2007 13:12:22 GMT</pubDate></item></channel></rss>