<?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[C++ Anfänger Array einbinden!]]></title><description><![CDATA[<p>Also mein Programm sieht wie folgt aus:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;iostream.h&gt;
#include &lt;string.h&gt;

       struct artikel 
{
		float preis;
		int nummer,lgbestand,menu,anzahl;
		char name[20];
};	

void main (void) 

	{
		int auswahl,x;
		struct artikel art; 

	do {

	cout &lt;&lt; &quot;\t\t\t\t&quot; &lt;&lt; &quot;Herzlich Willkommen&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;Waehlen Sie nun ihren Menuepunkt aus:&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;1.Eingabe der Artikel &quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;2.Ausgabe der Artikel&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;3.Speichern der Artikel &quot;    &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;4.Laden der Artikel&quot; &lt;&lt; endl; 
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;5.Loeschen der Artikel &quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;6.Suchen der Artikel &quot;	  &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;7.Sortieren der Artikel&quot; &lt;&lt; endl;
	cin  &gt;&gt; auswahl ;

	switch(auswahl)

	{

	case 1: 

			cout &lt;&lt; &quot;Geben Sie nun ihre Artikel mit folgenden Informationen an:&quot; &lt;&lt; endl;

			cout &lt;&lt; &quot;Der Lagerbestand sieht folgendermaßen aus:&quot; &lt;&lt; endl;
			cout &lt;&lt; &quot;Wieviel Buecher wollen Sie eingeben?&quot; &lt;&lt; endl;
			cin &gt;&gt; art.anzahl ;

			for (x=1;x&lt;=art.anzahl;x++)
				{

			cout &lt;&lt; &quot;Geben Sie bitte die Nummer ein&quot; &lt;&lt; endl;
			cin  &gt;&gt;  art.nummer ;

			cout &lt;&lt; &quot;Geben Sie bitte den Namen des Buches ein&quot;  &lt;&lt; endl;
			gets  (art.name);

			cout &lt;&lt; &quot;Geben Sie bitte den Preis an&quot; &lt;&lt; endl;
			cin  &gt;&gt;  art.preis		 ;

			cout &lt;&lt; &quot;Geben Sie bitte den Lagerbestand ein&quot; &lt;&lt; endl;
			cin  &gt;&gt; art.lgbestand ;

				}
			break;

	case 2:	
			for (x=1;x&lt;=art.anzahl;x++)
			{
				cout &lt;&lt; &quot;Artikelnummer:&quot;&lt;&lt; art.nummer &lt;&lt; endl;
			cout &lt;&lt; &quot;Artikelnamme:&quot; &lt;&lt; art.name &lt;&lt; endl;
			cout &lt;&lt; &quot;Artikelpreis:&quot; &lt;&lt; art.preis &lt;&lt; endl;
			cout &lt;&lt; &quot;Artikelbestand:&quot; &lt;&lt; art.lgbestand &lt;&lt; endl;
			}
	break;

	}

}
	while (1);

};
</code></pre>
<p>Es funktioniert auch!<br />
Aber bei der Ausgabbe , zeigt er mir nur das an was ich als letztes eingegeben habe!<br />
Ich wollte jetzt Arrays einbinden mit der Var art.anzahl in case 2!<br />
Kann mir jemand mal sagen wie ich das machen kann! Hab es versucht , aber klappt irgendwie nicht![cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/158021/c-anfänger-array-einbinden</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 14:11:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/158021.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 31 Aug 2006 15:08:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ Anfänger Array einbinden! on Thu, 31 Aug 2006 15:08:46 GMT]]></title><description><![CDATA[<p>Also mein Programm sieht wie folgt aus:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;iostream.h&gt;
#include &lt;string.h&gt;

       struct artikel 
{
		float preis;
		int nummer,lgbestand,menu,anzahl;
		char name[20];
};	

void main (void) 

	{
		int auswahl,x;
		struct artikel art; 

	do {

	cout &lt;&lt; &quot;\t\t\t\t&quot; &lt;&lt; &quot;Herzlich Willkommen&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;Waehlen Sie nun ihren Menuepunkt aus:&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;1.Eingabe der Artikel &quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;2.Ausgabe der Artikel&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;3.Speichern der Artikel &quot;    &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;4.Laden der Artikel&quot; &lt;&lt; endl; 
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;5.Loeschen der Artikel &quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;6.Suchen der Artikel &quot;	  &lt;&lt; endl;
	cout &lt;&lt; &quot;\t&quot; &lt;&lt; &quot;7.Sortieren der Artikel&quot; &lt;&lt; endl;
	cin  &gt;&gt; auswahl ;

	switch(auswahl)

	{

	case 1: 

			cout &lt;&lt; &quot;Geben Sie nun ihre Artikel mit folgenden Informationen an:&quot; &lt;&lt; endl;

			cout &lt;&lt; &quot;Der Lagerbestand sieht folgendermaßen aus:&quot; &lt;&lt; endl;
			cout &lt;&lt; &quot;Wieviel Buecher wollen Sie eingeben?&quot; &lt;&lt; endl;
			cin &gt;&gt; art.anzahl ;

			for (x=1;x&lt;=art.anzahl;x++)
				{

			cout &lt;&lt; &quot;Geben Sie bitte die Nummer ein&quot; &lt;&lt; endl;
			cin  &gt;&gt;  art.nummer ;

			cout &lt;&lt; &quot;Geben Sie bitte den Namen des Buches ein&quot;  &lt;&lt; endl;
			gets  (art.name);

			cout &lt;&lt; &quot;Geben Sie bitte den Preis an&quot; &lt;&lt; endl;
			cin  &gt;&gt;  art.preis		 ;

			cout &lt;&lt; &quot;Geben Sie bitte den Lagerbestand ein&quot; &lt;&lt; endl;
			cin  &gt;&gt; art.lgbestand ;

				}
			break;

	case 2:	
			for (x=1;x&lt;=art.anzahl;x++)
			{
				cout &lt;&lt; &quot;Artikelnummer:&quot;&lt;&lt; art.nummer &lt;&lt; endl;
			cout &lt;&lt; &quot;Artikelnamme:&quot; &lt;&lt; art.name &lt;&lt; endl;
			cout &lt;&lt; &quot;Artikelpreis:&quot; &lt;&lt; art.preis &lt;&lt; endl;
			cout &lt;&lt; &quot;Artikelbestand:&quot; &lt;&lt; art.lgbestand &lt;&lt; endl;
			}
	break;

	}

}
	while (1);

};
</code></pre>
<p>Es funktioniert auch!<br />
Aber bei der Ausgabbe , zeigt er mir nur das an was ich als letztes eingegeben habe!<br />
Ich wollte jetzt Arrays einbinden mit der Var art.anzahl in case 2!<br />
Kann mir jemand mal sagen wie ich das machen kann! Hab es versucht , aber klappt irgendwie nicht![cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1128532</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1128532</guid><dc:creator><![CDATA[DrKoRn]]></dc:creator><pubDate>Thu, 31 Aug 2006 15:08:46 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfänger Array einbinden! on Thu, 31 Aug 2006 15:19:48 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Sorry, dass ich nerve, aber:</p>
<p>1. du bist im falschem Forum<br />
2. benutze bitte iostream statt iostream.h<br />
3. es heißt int main und nicht void main</p>
<p>Zu 2. und 3. kannst du dir ja mal im C++-Forum einen Thread anschauen, der &quot;Die meistgestellten Fragen&quot; heißt.</p>
<p>Wie hast du denn was probiert?</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1128538</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1128538</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Thu, 31 Aug 2006 15:19:48 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfänger Array einbinden! on Thu, 31 Aug 2006 20:38:17 GMT]]></title><description><![CDATA[<p>@chrische5<br />
Ich glaube, dass das da oben sein Versuch ist ^^</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/13587">@DrKoRn</a><br />
Ist es dein Versuch? Dann mal eine Frage von mir:<br />
Wie soll dein Programm wissen, dass es, das struct artikel soviel mal anlegen soll, wie du es in artikel::anzahl definierst? ^^</p>
<p>Wie man dies nun lösen könnte?<br />
Vielleicht so:</p>
<pre><code class="language-cpp">// Alle Includes.

struct SArtikel
{
    float fPreis;
    int nNummber;
    int nBestand;
    char cName[20];
}

using namespace std;

int main()
{
    unsigned int nAnzahl = 0;

    // bla bla bla
    cin &gt;&gt; nAnzahl;

    SArtikel* aArtikel = new SArtikel[nAnzahl]; // Auf dem Heap nAnzahl SArtikel-Speicher reservieren.

    // Alle SArtikel Strukturen durchlaufen.
    for(int i = 0; i &lt; nAnzahl; ++i)
    {
        // Struktur befüllen oder leeren oder lesen oder was auch immer.
        aArtikel[i].nNumber = 1;
        // ... usw. ...
    }

    // Am Ende ...
    // Den Speicher vom Array wieder freigeben.
    delete [] aArtikel;
}
</code></pre>
<p>Hab nur das wesentliche drin gelassen. Die ganze Arbeit nehm ich dir ja auch nicht ab. Zudem würde ich vorschlagen, dass du dir ein C++ oder C Tutorial reinziehst. Das sind Grundlagen, die sollte man einfach kennen. Und das kann man am allerbesten lernen per Tutorial. Und das nächste mal bitte ins richtige Forum ^^</p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1128718</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1128718</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Thu, 31 Aug 2006 20:38:17 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfänger Array einbinden! on Fri, 01 Sep 2006 05:52:56 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=9713" rel="nofollow">estartu</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=1" rel="nofollow">MFC (Visual C++)</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1128791</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1128791</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Fri, 01 Sep 2006 05:52:56 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfänger Array einbinden! on Fri, 01 Sep 2006 09:15:19 GMT]]></title><description><![CDATA[<p>Benutz lieber Vektoren statt &quot;normale&quot; Arrays.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1128893</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1128893</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Fri, 01 Sep 2006 09:15:19 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Anfänger Array einbinden! on Fri, 01 Sep 2006 14:33:55 GMT]]></title><description><![CDATA[<p>Ja soll aber mit arrays passieren! Ist ne Schulaufgabe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1129211</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1129211</guid><dc:creator><![CDATA[DrKoRn]]></dc:creator><pubDate>Fri, 01 Sep 2006 14:33:55 GMT</pubDate></item></channel></rss>