<?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[min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s]]></title><description><![CDATA[<p>Hallo,</p>
<p>habe ein problem, ich soll verschiedene Messwerte in ein float-array einlesen und dieses auf mehrere Minimums und Maximums analysieren. Und diese Stellen dann dokumentieren!</p>
<p>Ich habs jetzt soweit das ich die min, max und die mittelwerte werte angezeigt kriege! Nur wie kriege ichs hin das ich mehrere gleiche werte aus dem array HERAUSLESEN kann(z.B. alle Minimums) und die Dokumentiert kriege (z.B.Messwert 35 = Min)</p>
<p>Bin echt am verzweifeln, hab schon einiges ausprobiert und es klappt einfach nicht! Wäre um jede Hilfe dankbar!!</p>
<p>Hier ist mein QUELLCODE:</p>
<p>#include &lt;stdio.h&gt;<br />
#include &lt;conio.h&gt;</p>
<p>void main()<br />
{</p>
<p>int anzahl, i;<br />
float messwertarray[100], summe = 0.0,mittelwert, min, max;</p>
<p>printf(&quot;bitte geben Sie die anzahl der Messwerte ein : &quot;);<br />
scanf(&quot;%i&quot;,&amp;anzahl);</p>
<p>for (i = 0; i &lt;anzahl; i++)<br />
{<br />
printf(&quot;Bitte %i.messwert eingeben &quot;,i+1);<br />
scanf(&quot;%f&quot;,&amp;messwertarray[i]);<br />
summe=summe+messwertarray[i];<br />
}<br />
for (i=0;i&lt;anzahl;i++)<br />
{<br />
if (i == 0)<br />
{<br />
min = messwertarray[i];<br />
max = messwertarray[i];<br />
}</p>
<p>if (max &lt; messwertarray[i])<br />
{<br />
max = messwertarray[i];<br />
}<br />
if (min &gt; messwertarray[i])<br />
{<br />
min = messwertarray[i];<br />
}<br />
}<br />
mittelwert=summe/anzahl;<br />
printf(&quot;\n\nDer max-Wert betraegt : %f\n&quot;,max);<br />
printf(&quot;Der Mittelwertbetraegt: %f\n&quot;,mittelwert);<br />
printf(&quot;Der min-Wert betraegt : %f&quot;,min);</p>
<p>getch();<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/161399/min-amp-max-amp-mittelwert-und-doku-über-mehrere-min-s-und-max-s</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 22:54:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/161399.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 06 Oct 2006 09:55:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 09:55:41 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>habe ein problem, ich soll verschiedene Messwerte in ein float-array einlesen und dieses auf mehrere Minimums und Maximums analysieren. Und diese Stellen dann dokumentieren!</p>
<p>Ich habs jetzt soweit das ich die min, max und die mittelwerte werte angezeigt kriege! Nur wie kriege ichs hin das ich mehrere gleiche werte aus dem array HERAUSLESEN kann(z.B. alle Minimums) und die Dokumentiert kriege (z.B.Messwert 35 = Min)</p>
<p>Bin echt am verzweifeln, hab schon einiges ausprobiert und es klappt einfach nicht! Wäre um jede Hilfe dankbar!!</p>
<p>Hier ist mein QUELLCODE:</p>
<p>#include &lt;stdio.h&gt;<br />
#include &lt;conio.h&gt;</p>
<p>void main()<br />
{</p>
<p>int anzahl, i;<br />
float messwertarray[100], summe = 0.0,mittelwert, min, max;</p>
<p>printf(&quot;bitte geben Sie die anzahl der Messwerte ein : &quot;);<br />
scanf(&quot;%i&quot;,&amp;anzahl);</p>
<p>for (i = 0; i &lt;anzahl; i++)<br />
{<br />
printf(&quot;Bitte %i.messwert eingeben &quot;,i+1);<br />
scanf(&quot;%f&quot;,&amp;messwertarray[i]);<br />
summe=summe+messwertarray[i];<br />
}<br />
for (i=0;i&lt;anzahl;i++)<br />
{<br />
if (i == 0)<br />
{<br />
min = messwertarray[i];<br />
max = messwertarray[i];<br />
}</p>
<p>if (max &lt; messwertarray[i])<br />
{<br />
max = messwertarray[i];<br />
}<br />
if (min &gt; messwertarray[i])<br />
{<br />
min = messwertarray[i];<br />
}<br />
}<br />
mittelwert=summe/anzahl;<br />
printf(&quot;\n\nDer max-Wert betraegt : %f\n&quot;,max);<br />
printf(&quot;Der Mittelwertbetraegt: %f\n&quot;,mittelwert);<br />
printf(&quot;Der min-Wert betraegt : %f&quot;,min);</p>
<p>getch();<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150434</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150434</guid><dc:creator><![CDATA[Timmää]]></dc:creator><pubDate>Fri, 06 Oct 2006 09:55:41 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 09:58:37 GMT]]></title><description><![CDATA[<p>Nur ein Ansatz:</p>
<pre><code class="language-cpp">for(i=0;i&lt;anzahl;++i)
  if(max == wert[i]) cout&lt;&lt;&quot;Element &quot;&lt;&lt;i&lt;&lt;&quot;ist maximal\n&quot;;
</code></pre>
<p>(PS: schreibst du C oder C++?)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150441</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150441</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Fri, 06 Oct 2006 09:58:37 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 10:05:44 GMT]]></title><description><![CDATA[<p>Danke erstmal für die schnelle antwort!</p>
<p>Schreibe in C++</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150447</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150447</guid><dc:creator><![CDATA[Timmää]]></dc:creator><pubDate>Fri, 06 Oct 2006 10:05:44 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 10:48:56 GMT]]></title><description><![CDATA[<p>Habe es jetzt versucht,<br />
muss aber auch sagen das ich bisher nicht mit dem cout-Befehl gearbeitet habe!Bin noch relativ frisch auf dem gebiet!</p>
<p>Kriege bei dem cout befehl immer'ne Fehlermeldung, hatte es dann so versucht:</p>
<p>for(i=0;i&lt;anzahl;++i)<br />
{<br />
if(max == messwertarray[i])<br />
{<br />
printf(&quot;\nMesswert %i ist maximal\n&quot;,messwertarray[i]);<br />
}<br />
}</p>
<p>bloß wenn ich jetzt z.B. 3 Max`s habe, kriege ich die meldung auch drei mal was auch richtig ist.<br />
Nur die Meldung heißt dann immer &quot;Messwert 0 ist maximal&quot;, wie kriege ich denn die tatsächliche Messwertzahl!?</p>
<p>Wäre für noch so ein Ansatz sehr Dankbar!!</p>
<p>Mein quellcode sieht jetzt so aus:</p>
<p>#include &lt;stdio.h&gt;<br />
#include &lt;conio.h&gt;</p>
<p>void main()<br />
{</p>
<p>int anzahl, i;<br />
float messwertarray[100], summe = 0.0,mittelwert, min, max,cout;</p>
<p>printf(&quot;bitte geben Sie die anzahl der Messwerte ein : &quot;);<br />
scanf(&quot;%i&quot;,&amp;anzahl);</p>
<p>for (i = 0; i &lt;anzahl; i++)<br />
{<br />
printf(&quot;Bitte %i.messwert eingeben &quot;,i+1);<br />
scanf(&quot;%f&quot;,&amp;messwertarray[i]);<br />
summe=summe+messwertarray[i];<br />
}<br />
for (i=0;i&lt;anzahl;i++)<br />
{<br />
if (i == 0)<br />
{<br />
min = messwertarray[i];<br />
max = messwertarray[i];<br />
}</p>
<p>if (max &lt; messwertarray[i])<br />
{<br />
max = messwertarray[i];<br />
}<br />
if (min &gt; messwertarray[i])<br />
{<br />
min = messwertarray[i];<br />
}</p>
<p>}<br />
mittelwert=summe/anzahl;<br />
printf(&quot;\n\nDer max-Wert betraegt : %f\n&quot;,max);<br />
printf(&quot;Der Mittelwertbetraegt: %f\n&quot;,mittelwert);<br />
printf(&quot;Der min-Wert betraegt : %f&quot;,min);<br />
for(i=0;i&lt;anzahl;++i)<br />
{<br />
if(max == messwertarray[i])<br />
{<br />
printf(&quot;\nMesswert %i ist maximal\n&quot;,messwertarray[i]);<br />
}<br />
}</p>
<p>getch();<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150481</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150481</guid><dc:creator><![CDATA[Timmää]]></dc:creator><pubDate>Fri, 06 Oct 2006 10:48:56 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 12:06:16 GMT]]></title><description><![CDATA[<p>// untested - eben ausn kopf geschrieben</p>
<pre><code class="language-cpp">#include &lt;iostream&gt; 

int main() 
{ 
    int anzahl = 0; 
    float messwertarray[100] = {'0.0'}; 
    float summe = 0.0; 
    float mittelwert = 0.0; 
    float min = 1.0; 
    float max = 1.0; 

    std::cout &lt;&lt; &quot;Bitte geben Sie die anzahl der Messwerte ein: &quot;; 
    std::cin &gt;&gt; anzahl; 

    for( int i=0; i&lt;anzahl; i++) 
    { 
        std::cout &lt;&lt; &quot;Bitte &quot; &lt;&lt; i+1 &lt;&lt; &quot;. messwert eingeben: &quot;; 
        std::cin &gt;&gt; messwertarray[i]; 

        summe += messwertarray[i]; 

        if( max &lt;= messwertarray[i] ){ 
            if( max == messwertarray[i] ) 
                std::cout &lt;&lt; &quot;Element &quot; &lt;&lt; i &lt;&lt; &quot;ist maximal\n&quot;; 
            else 
                max = messwertarray[i] ;
        } 
        if( min &gt;= messwertarray[i] ){ 
            if( min == messwertarray[i] ) 
                std::cout &lt;&lt; &quot;Element &quot; &lt;&lt; i &lt;&lt; &quot; ist minimal&quot; &lt;&lt; std::endl; 
            else 
                min = messwertarray[i];
        } 
        if( i == 0 ) 
            min = max = messwertarray[i]; 
    } 
    mittelwert = summe/anzahl; 
    std::cout &lt;&lt; &quot;Der max-Wert betraegt: &quot; &lt;&lt; max &lt;&lt; std::endl; 
    std::cout &lt;&lt; &quot;Der min-Wert betraegt: &quot; &lt;&lt; min &lt;&lt; std::endl; 
    std::cout &lt;&lt; &quot;Der Mittelwert betraegt: &quot; &lt;&lt; mittelwert &lt;&lt; std::endl; 
    std::cin.get(); 

    return 0; 
}
</code></pre>
<p>was fehlt ist das abfragen ob die eigegebenen werte erlaubt sind {dann return -X}</p>
<p>zb ist ein 0,0 kein float aber 0.0 schon usw - genauso wenn man zeichen statt zahlen eingibt usw</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150488</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150488</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Fri, 06 Oct 2006 12:06:16 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 11:48:51 GMT]]></title><description><![CDATA[<p>Erstmal besten dank,hab das prg getestet, ist leider sehr fehlerbehaftet!<br />
Hab einige weggemacht, klappt dann bei mir aber trotzdem nicht!</p>
<p>kann man evtl mein prg soweit erweitern das ich die richtige ausgabe kriege?</p>
<p>wäre echt nett wenn mir einer ein entsprechenden tipp geben könnte, denn wie ich schon schrieb bin ich relativ frisch auf dem gebiet und das prg von Mr Evil ist neue Materie für mich, will erstmal die alte komplett verstehn...</p>
<p>Danke vorrab!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150537</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150537</guid><dc:creator><![CDATA[Timmää]]></dc:creator><pubDate>Fri, 06 Oct 2006 11:48:51 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 12:09:35 GMT]]></title><description><![CDATA[<p>sehr fehlerbehaftet? Wo denn? Der Header ist falsch (&lt;iostream&gt; wäre richtig), hier und da fehlt ein Semikolon. Na gut, das hier:</p>
<p>float messwertarray[100]</p>
<p>geht so natürlich nicht. Entweder fügt man eine Sicherheitsabfrage ein, die das Überlaufen des Arrays verhindert oder (viel besser) man verwendet einen std::vector.</p>
<p>@Timmää: Das Problem mit deinem Programm ist, daß es finsteres C ist. Solche Sachen wie printf gehören hier einfach nicht her. Wenn du deinen Code mit solchen nutzlosen und gefährlichen Relikten vollstopfst und noch dazu deinen Code ohne Code-Tags postest, darfst du dich nicht wundern, wenn die Leute nicht willens sind deinen Code anzusehen. Ich bin es jedenfalls nicht.</p>
<p>Edit: Wenn man den Code so aufbaut wie MrEvil, braucht man eigentlich gar kein Array, weil man die eingegebenen Werte ja direkt verwendet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150549</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150549</guid><dc:creator><![CDATA[Z2]]></dc:creator><pubDate>Fri, 06 Oct 2006 12:09:35 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 12:08:33 GMT]]></title><description><![CDATA[<p>bin mein code oben nochmal ueberflogen</p>
<p>nu muesste es {theoretisch} funktionieren</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150552</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150552</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Fri, 06 Oct 2006 12:08:33 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 12:09:23 GMT]]></title><description><![CDATA[<p>Kann ja auch nix dafür das ich es so in der Schule beigebracht kriege!!<br />
Mache gerad mein Techniker und bin gerad ziemlich am Anfang!</p>
<p>Und nach dem Schema sollte ich in der Schule eine präsentation halten, deshalb wollte ich wissen wo ich den Bock reingehauen habe!</p>
<p>Kanns mir schon vorstellen das es einfacher geht, bloß dieses einfache krieg ich anscheinend nicht beigebracht!!</p>
<p>Nochmals Sorry, wär trotzdem nett wenn da jemand drüberfliegt!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150553</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150553</guid><dc:creator><![CDATA[Timmää]]></dc:creator><pubDate>Fri, 06 Oct 2006 12:09:23 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 12:36:40 GMT]]></title><description><![CDATA[<p>Timmää schrieb:</p>
<blockquote>
<p>Nochmals Sorry, wär trotzdem nett wenn da jemand drüberfliegt!!</p>
</blockquote>
<p>Die Anzahl deiner Helfer vergrößert sich potentiell dramatisch wenn du deinen Code ordentlich eingerückt &amp; gehighlightet präsentierst...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150572</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150572</guid><dc:creator><![CDATA[finix]]></dc:creator><pubDate>Fri, 06 Oct 2006 12:36:40 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 12:42:26 GMT]]></title><description><![CDATA[<p>@ Mr Evil</p>
<p>Bin mit dem Borland c++ Builder 6 am Arbeiten.<br />
Habe das Prg ausprobiert, es läuft bis zur eingabe des letzten wertes und bricht dann ab!<br />
Liegt das am Borland oder am Prg.?</p>
<p>Echt ratlos...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150581</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150581</guid><dc:creator><![CDATA[Timmää]]></dc:creator><pubDate>Fri, 06 Oct 2006 12:42:26 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 13:28:05 GMT]]></title><description><![CDATA[<p>hatte kurzzeitig langeweile #gg</p>
<pre><code class="language-cpp">#include &lt;iostream&gt; 
#include &lt;vector&gt;

class CMinMax
{
private:
	std::vector&lt; float &gt;m_vValues;
	int m_iNumbers;
	float m_fMin;
	float m_fMax;
	float m_fAverange;
	float m_fSummary;
public:
	void Run();
	void GetNumbers();
	void GetCount();
	void CheckMin();
	void CheckMax();
	void GetSummary();
	void GetAverange();
	void CheckParity();
	void Output();
	void Pause();
	CMinMax()
	{
		m_iNumbers = 0;
		m_fMin = 0.0;
		m_fMax = 0.0;
		m_fAverange = 0.0;
		m_fSummary = 0.0;
	}
};
int main() 
{ 
    CMinMax cminmax;
	cminmax.Run();
    return 0; 
} 
void CMinMax::Run()
{
	GetCount();
	GetNumbers();
	CheckMin();
	CheckMax();
	GetSummary();
	GetAverange();
	CheckParity();
	Output();
	Pause();
}
void CMinMax::GetCount()
{
	std::cout &lt;&lt; &quot;Bitte geben Sie die anzahl der Messwerte ein: &quot;; 
    std::cin &gt;&gt; m_iNumbers; 
}
void CMinMax::GetNumbers()
{
	float fBuffer = 0.0;
    for( int i=0; i&lt;m_iNumbers; i++ ) 
    { 
        std::cout &lt;&lt; &quot;Bitte &quot; &lt;&lt; i+1 &lt;&lt; &quot;. messwert eingeben: &quot;; 
		std::cin &gt;&gt; fBuffer;

		m_vValues.push_back( fBuffer );
	}
}
void CMinMax::CheckMin()
{
	m_fMin = m_vValues[0];
	for( int i=0; i&lt;m_iNumbers; i++ )
	{
		if( m_fMin &gt; m_vValues[i] )
			m_fMin = m_vValues[i];
	}
}
void CMinMax::CheckMax()
{
	m_fMax = m_vValues[0];
	for( int i=0; i&lt;m_iNumbers; i++ )
	{
		if( m_fMax &lt; m_vValues[i] )
			m_fMax = m_vValues[i];
	}
}
void CMinMax::GetSummary()
{
	for( int i=0; i&lt;m_iNumbers; i++ )
		m_fSummary += m_vValues[i];
}
void CMinMax::GetAverange()
{
	m_fAverange = m_fSummary/m_iNumbers;
}
void CMinMax::CheckParity()
{
	std::vector&lt; std::string &gt;vLine;

	std::cout &lt;&lt; std::endl;
	char buff[512] = {'\0'};
	int more = 0;

	for( int i=0; i&lt;m_iNumbers; i++ )
	{
		if( m_fMax == m_vValues[i] )
			std::cout &lt;&lt; &quot;Element &quot; &lt;&lt; i+1 &lt;&lt; &quot; ist maximal&quot; &lt;&lt; std::endl;
	}
	for( int i=0; i&lt;m_iNumbers; i++ )
	{
		if( m_fMin == m_vValues[i] )
			std::cout &lt;&lt; &quot;Element &quot; &lt;&lt; i+1 &lt;&lt; &quot; ist minimal&quot; &lt;&lt; std::endl; 
	}
}
void CMinMax::Output()
{
	std::cout &lt;&lt; std::endl;
	std::cout &lt;&lt; &quot;Der max-Wert betraegt: &quot; &lt;&lt; m_fMax &lt;&lt; std::endl; 
	std::cout &lt;&lt; &quot;Der min-Wert betraegt: &quot; &lt;&lt; m_fMin &lt;&lt; std::endl; 
	std::cout &lt;&lt; &quot;Der Mittelwert betraegt: &quot; &lt;&lt; m_fAverange &lt;&lt; std::endl; 
	std::cout &lt;&lt; &quot;Die Summe betraegt: &quot; &lt;&lt; m_fSummary &lt;&lt; std::endl;
}
void CMinMax::Pause()
{
	std::cin.get();
	std::cin.get();
}
</code></pre>
<p>/edit - bloede tippfehler</p>
<p>das das programm abbricht liegt evtl daran das nur einmal cin,get(); war, er hat das enter zeichen noch im speicher von der letzten eingabe, darum bekommt er mit get() immer was geholt und denkt du hast enter gemacht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150607</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150607</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Fri, 06 Oct 2006 13:28:05 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 13:35:19 GMT]]></title><description><![CDATA[<p>@ finix<br />
Danke für den tipp!<br />
@ Mr Evil<br />
!Danke! !Danke!</p>
<p>Hier noch mal mein Quellcode, hoffe das es diesmal besser ist:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;conio.h&gt;

void main()
{

  int anzahl, i;
  float messwertarray[100], summe = 0.0,mittelwert, min, max,cout;

  printf(&quot;bitte geben Sie die anzahl der Messwerte ein : &quot;);
  scanf(&quot;%i&quot;,&amp;anzahl);

  for (i = 0; i &lt;anzahl; i++)
  {
    printf(&quot;Bitte %i.messwert eingeben &quot;,i+1);
    scanf(&quot;%f&quot;,&amp;messwertarray[i]);
     summe=summe+messwertarray[i];
  }
        for (i=0;i&lt;anzahl;i++)
        {
                if (i == 0)
                {
                 min = messwertarray[i];
                 max = messwertarray[i];
                }

                if (max &lt; messwertarray[i])
                {
                 max = messwertarray[i];
                }
                if (min &gt; messwertarray[i])
                {
                 min = messwertarray[i];
                }

        }
  mittelwert=summe/anzahl;
  printf(&quot;\n\nDer max-Wert betraegt : %f\n&quot;,max);
  printf(&quot;Der Mittelwertbetraegt: %f\n&quot;,mittelwert);
  printf(&quot;Der min-Wert betraegt : %f\n&quot;,min);

  for(i=0;i&lt;anzahl;i++)
  {
        if(max == messwertarray[i])
        {
        printf(&quot;\nElement %i ist maximal&quot;,messwertarray[i]) ;
        }
  }
  getch();
}
</code></pre>
<p>Wie gesagt, es stimmt soweit alles bis auf die Ausgabe mehrerer Max-werte!<br />
Es werden 3 zeilen angezeigt wenn es z.B 3 maxwerte gibt bloß mit der ausgabe:<br />
&quot;Element 0 ist maximal&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150616</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150616</guid><dc:creator><![CDATA[Timmää]]></dc:creator><pubDate>Fri, 06 Oct 2006 13:35:19 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 13:48:25 GMT]]></title><description><![CDATA[<p>Du zeigt auch nicht die Elementnummer an (das wäre i oder i+1 wie bei Deiner Messwerteingabe), sondern denn Wert des Elements. Ist bei Deinen Beispielen der Maximalwert immer 0?</p>
<p>Also statt:</p>
<pre><code class="language-cpp">printf(&quot;\nElement %i ist maximal&quot;,messwertarray[i]) ;
</code></pre>
<p>solltest Du i+1 ausgeben.</p>
<pre><code class="language-cpp">printf(&quot;\nElement %i ist maximal&quot;,i+1) ;
</code></pre>
<p>Denn Rest des Programmes habe ich mir jetzt nicht genauer angesehen.</p>
<p>DJohn</p>
<p><strong>Edit:</strong> i zu i+1 geändert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150624</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150624</guid><dc:creator><![CDATA[DJohn]]></dc:creator><pubDate>Fri, 06 Oct 2006 13:48:25 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 13:49:50 GMT]]></title><description><![CDATA[<p>ersetze</p>
<pre><code class="language-cpp">printf(&quot;\nElement %i ist maximal&quot;,messwertarray[i]) ;
</code></pre>
<p>mit</p>
<pre><code class="language-cpp">printf(&quot;\nElement %d ist maximal&quot;, i+1 );
</code></pre>
<p>dann klappts auch {o;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150630</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150630</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Fri, 06 Oct 2006 13:49:50 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 14:04:43 GMT]]></title><description><![CDATA[<p>grad n guter zeitvertreib #gg<br />
dein code in angepasster form</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt; 
#include &lt;conio.h&gt; 

void main() 
{ 
    int iAnzahl, i; 
    float fMesswertarray[100] = { '0.0' }
    float fSumme = 0.0
    float fMittelwert = 0.0
    float fMin = 0.0
    float fMax = 0.0
//    float fCount = 0.0;    // wofuer ist die

    printf( &quot;bitte geben Sie die anzahl der Messwerte ein : &quot; ); 
    scanf( &quot;%i&quot;, &amp;iAnzahl ); 

    for( i=0; i&lt;iAnzahl; i++ ) 
    { 
        printf( &quot;Bitte %i. messwert eingeben &quot;,i+1 ); 
        scanf( &quot;%f&quot;, &amp;fMesswertarray[i] ); 
        fSumme += fMesswertarray[i]; 
    } 
    for( i=0; i&lt;iAnzahl; i++ ) 
    { 
        if( i == 0 ) 
            fMax = fMin = fMesswertarray[i]; 

        if( fMax &lt; fMesswertarray[i] ) 
            fMax = fMesswertarray[i]; 

        if( fMin &gt; fMesswertarray[i] ) 
            fMin = fMesswertarray[i]; 

    } 
    fMittelwert = fSumme / iAnzahl; 

    printf( &quot;\n\nDer max-Wert betraegt : %f\n&quot;, fMax ); 
    printf( &quot;Der Mittelwertbetraegt: %f\n&quot;, fMittelwert ); 
    printf( &quot;Der min-Wert betraegt : %f\n&quot;, fMin ); 

    for( i=0; i&lt;iAnzahl; i++ ) 
    { 
        if( fMax == fMesswertarray[i] ) 
            printf( &quot;\nElement %d ist maximal&quot;, i+1 ) ; 
    } 
    getch(); 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1150637</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150637</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Fri, 06 Oct 2006 14:04:43 GMT</pubDate></item><item><title><![CDATA[Reply to min&amp;amp;max&amp;amp;mittelwert und doku über mehrere min-s und max-s on Fri, 06 Oct 2006 14:41:08 GMT]]></title><description><![CDATA[<p><strong>!!!Besten Dank für eure Hilfe!!!</strong></p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /> <strong>Alle Fehler behoben!</strong></p>
<p>Dieses Forum is der Knaller...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150657</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150657</guid><dc:creator><![CDATA[Timmää]]></dc:creator><pubDate>Fri, 06 Oct 2006 14:41:08 GMT</pubDate></item></channel></rss>