<?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[Feher C2062, Hilfe!]]></title><description><![CDATA[<p>Ich bin noch blutiger Anfänger und habe noch wenig Erfahrung, deshalb habe ich versucht einen primitiven Taschenrechner zu programmieren, dieser liefert jedoch Fehlermeldungen auf die ich nicht mehr weiter weiss.</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

	bool defOperator = 1; // 1 bei definiertem Operator, 0 bei nicht definiertem Operator
	float Ergebnis;
	int Ende;
float main ()
{
	float Eingabe1, Eingabe2; //Eingabe1 = Erste Zahl, Eingabe2 = Zweite Zahl, Eingabe3 = Operator
	int Eingabe3,Eingabe2ganz,Eingabe1ganz;
	float  plus (float Eingabe1,float Eingabe2,float Ergebnis); //Prototypen
	float minus (float Eingabe1,float Eingabe2,float Ergebnis);
	float mal (float Eingabe1,float Eingabe2,float Ergebnis);
	float geteilt (float Eingabe1,float Eingabe2,float Ergebnis);
	float rest (float Eingabe1,float Eingabe2,float Ergebnis);
	//void rechnen ();
	float ergebnis(int Eingabe3);
	cout &lt;&lt; &quot;Der Rechner ist bereit fuer deine Eingaben. \n&quot;;
	cout &lt;&lt; &quot;Bitte gebe nun deine erste Zahl ein...&quot; &lt;&lt; endl;
	cin &gt;&gt; Eingabe1;
	cout &lt;&lt; &quot;Bitte gebe nun deine zweite Zahl ein...&quot; &lt;&lt; endl;
	cin &gt;&gt; Eingabe2;
	cout &lt;&lt; &quot;Bitte gebe nun den Operator an.\n&quot;;
	cout &lt;&lt; &quot;Tippe 1 fuer + \n &quot;;
	cout &lt;&lt; &quot;Tippe 2 fuer - \n &quot;;
	cout &lt;&lt; &quot;Tippe 3 fuer geteilt durch \n &quot;;
	cout &lt;&lt; &quot;Tippe 4 fuer * \n&quot;;
	cout &lt;&lt; &quot;Tippe 5 fuer Modolu \n&quot;;
	cin &gt;&gt; Eingabe3;
	//rechnen ();
	float ergebnis (int Eingabe3);
	return Ergebnis;
}

float plus (float Eingabe1,float Eingabe2,float Ergebnis)
{
	Ergebnis = Eingabe1 + Eingabe2;
	return Ergebnis;
}

float minus (float Eingabe1,float Eingabe2,float Ergebnis)
{
	Ergebnis = Eingabe1 - Eingabe2;
	return Ergebnis;
}

float geteilt (float Eingabe1,float Eingabe2,float Ergebnis)
{
	Ergebnis = Eingabe1 / Eingabe2;
	if ( Eingabe2 == 0 )
		{
		cout &lt;&lt; &quot;Teilen durh 0 ist nicht definiert.&quot; &lt;&lt; endl;
		defOperator = 0;
		}
					//if (Eingabe1%Eingabe != 0)
					//{ cout &lt;&lt; &quot;Rest ist &quot; &lt;&lt; Eingabe1%Eingabe &lt;&lt; endl;}
	return Ergebnis;
}

float mal (float Eingabe1,float Eingabe2,float Ergebnis)
{
	Ergebnis = Eingabe1 * Eingabe2;
	return Ergebnis;
}

float rest (float Eingabe1,float Eingabe2,float Ergebnis,int Eingabe1ganz,int Eingabe2ganz)
{
	Eingabe1ganz = static_cast&lt;int&gt; (Eingabe1); //Eingaben müssen ganzzahlig sein
	Eingabe2ganz = static_cast&lt;int&gt; (Eingabe2); //Eingaben müssen ganzahlig sein
	cout &lt;&lt; &quot;Fuer Modulorechnung sind nur ganzzahlige Werte erlaubt, Werte werden nun ganzzahlig gemacht, Informationsverlust moeglich! \n&quot;;
	Ergebnis = static_cast&lt;float&gt; (Eingabe1ganz%Eingabe2ganz);
	return Ergebnis;
}

/*void rechnen ()  //NICHT BEACHTEN
{
	if (Eingabe3 == 1)
			{
			plus();
			}
		else if (Eingabe3 == 2)
			{
			minus();
			}
			else if (Eingabe3 == 3)
				{
				geteilt ();
				}
					else if (Eingabe3 == 4)
						{
						mal ();
						}
						else if (Eingabe3 == 5)
							{
							rest ();	
							}
							else
							 {
								 cout &lt;&lt; &quot;Operator nicht definiert&quot; &lt;&lt; endl;
								 defOperator = 0;				
							 }
}*/ //NICHT BEACHTEN ENDE

void ergebnis (int Eingabe3,float Eingabe1,float Eingabe2,float Ergebnis)
{
if (Eingabe3 == 1)
	{
	Ergebnis = float plus (float Eingabe1,float Eingabe2,float Ergebnis)
	}
	else if (Eingabe3 == 2)
		{
		Ergebnis = float minus (float Eingabe1,float Eingabe2,float Ergebnis)
		}
		else if (Eingabe3 == 3)
			{
			Ergebnis = float geteilt (float Eingabe1,float Eingabe2,float Ergebnis)
			}
			else if (Eingabe3 == 4)
				{
				Ergebnis = float mal (float Eingabe1,float Eingabe2,float Ergebnis)
				}
				else if (Eingabe3 == 5)
					{
					Ergebnis = float rest (float Eingabe1,float Eingabe2,float Ergebnis,int Eingabe1ganz,int Eingabe2´ganz)
					}
if ( defOperator == 1 )
		{cout &lt;&lt; &quot;Das Ergebnis ist: &quot; &lt;&lt; Ergebnis &lt;&lt; &quot;\a&quot; &lt;&lt; endl;}
	else
		Ergebnis = 0;
	cin &gt;&gt; Ende;
}
</code></pre>
<p>Diese Meldungen kommen beim kompilieren:<br />
1.cpp(11) : warning C4101: 'Eingabe2ganz': Unreferenzierte lokale Variable<br />
1.cpp(11) : warning C4101: 'Eingabe1ganz': Unreferenzierte lokale Variable<br />
1.cpp(110) : error C2062: 'float'-Typ unerwartet<br />
1.cpp(114) : error C2062: 'float'-Typ unerwartet<br />
1.cpp(118) : error C2062: 'float'-Typ unerwartet<br />
1.cpp(122) : error C2062: 'float'-Typ unerwartet<br />
1.cpp(126) : error C2062: 'float'-Typ unerwartet</p>
<p>Abgesehen von den ersten beiden Warnungen habe ich keine Ahnung was die Meldungen bedeuten , und auf den Seiten hier ist die Lösung immer irgendein Semikolon Fehler, davon habe ich hier aber keinen gfunden.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/312204/feher-c2062-hilfe</link><generator>RSS for Node</generator><lastBuildDate>Mon, 03 Aug 2026 02:03:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/312204.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 Dec 2012 13:38:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Feher C2062, Hilfe! on Fri, 28 Dec 2012 13:38:07 GMT]]></title><description><![CDATA[<p>Ich bin noch blutiger Anfänger und habe noch wenig Erfahrung, deshalb habe ich versucht einen primitiven Taschenrechner zu programmieren, dieser liefert jedoch Fehlermeldungen auf die ich nicht mehr weiter weiss.</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

	bool defOperator = 1; // 1 bei definiertem Operator, 0 bei nicht definiertem Operator
	float Ergebnis;
	int Ende;
float main ()
{
	float Eingabe1, Eingabe2; //Eingabe1 = Erste Zahl, Eingabe2 = Zweite Zahl, Eingabe3 = Operator
	int Eingabe3,Eingabe2ganz,Eingabe1ganz;
	float  plus (float Eingabe1,float Eingabe2,float Ergebnis); //Prototypen
	float minus (float Eingabe1,float Eingabe2,float Ergebnis);
	float mal (float Eingabe1,float Eingabe2,float Ergebnis);
	float geteilt (float Eingabe1,float Eingabe2,float Ergebnis);
	float rest (float Eingabe1,float Eingabe2,float Ergebnis);
	//void rechnen ();
	float ergebnis(int Eingabe3);
	cout &lt;&lt; &quot;Der Rechner ist bereit fuer deine Eingaben. \n&quot;;
	cout &lt;&lt; &quot;Bitte gebe nun deine erste Zahl ein...&quot; &lt;&lt; endl;
	cin &gt;&gt; Eingabe1;
	cout &lt;&lt; &quot;Bitte gebe nun deine zweite Zahl ein...&quot; &lt;&lt; endl;
	cin &gt;&gt; Eingabe2;
	cout &lt;&lt; &quot;Bitte gebe nun den Operator an.\n&quot;;
	cout &lt;&lt; &quot;Tippe 1 fuer + \n &quot;;
	cout &lt;&lt; &quot;Tippe 2 fuer - \n &quot;;
	cout &lt;&lt; &quot;Tippe 3 fuer geteilt durch \n &quot;;
	cout &lt;&lt; &quot;Tippe 4 fuer * \n&quot;;
	cout &lt;&lt; &quot;Tippe 5 fuer Modolu \n&quot;;
	cin &gt;&gt; Eingabe3;
	//rechnen ();
	float ergebnis (int Eingabe3);
	return Ergebnis;
}

float plus (float Eingabe1,float Eingabe2,float Ergebnis)
{
	Ergebnis = Eingabe1 + Eingabe2;
	return Ergebnis;
}

float minus (float Eingabe1,float Eingabe2,float Ergebnis)
{
	Ergebnis = Eingabe1 - Eingabe2;
	return Ergebnis;
}

float geteilt (float Eingabe1,float Eingabe2,float Ergebnis)
{
	Ergebnis = Eingabe1 / Eingabe2;
	if ( Eingabe2 == 0 )
		{
		cout &lt;&lt; &quot;Teilen durh 0 ist nicht definiert.&quot; &lt;&lt; endl;
		defOperator = 0;
		}
					//if (Eingabe1%Eingabe != 0)
					//{ cout &lt;&lt; &quot;Rest ist &quot; &lt;&lt; Eingabe1%Eingabe &lt;&lt; endl;}
	return Ergebnis;
}

float mal (float Eingabe1,float Eingabe2,float Ergebnis)
{
	Ergebnis = Eingabe1 * Eingabe2;
	return Ergebnis;
}

float rest (float Eingabe1,float Eingabe2,float Ergebnis,int Eingabe1ganz,int Eingabe2ganz)
{
	Eingabe1ganz = static_cast&lt;int&gt; (Eingabe1); //Eingaben müssen ganzzahlig sein
	Eingabe2ganz = static_cast&lt;int&gt; (Eingabe2); //Eingaben müssen ganzahlig sein
	cout &lt;&lt; &quot;Fuer Modulorechnung sind nur ganzzahlige Werte erlaubt, Werte werden nun ganzzahlig gemacht, Informationsverlust moeglich! \n&quot;;
	Ergebnis = static_cast&lt;float&gt; (Eingabe1ganz%Eingabe2ganz);
	return Ergebnis;
}

/*void rechnen ()  //NICHT BEACHTEN
{
	if (Eingabe3 == 1)
			{
			plus();
			}
		else if (Eingabe3 == 2)
			{
			minus();
			}
			else if (Eingabe3 == 3)
				{
				geteilt ();
				}
					else if (Eingabe3 == 4)
						{
						mal ();
						}
						else if (Eingabe3 == 5)
							{
							rest ();	
							}
							else
							 {
								 cout &lt;&lt; &quot;Operator nicht definiert&quot; &lt;&lt; endl;
								 defOperator = 0;				
							 }
}*/ //NICHT BEACHTEN ENDE

void ergebnis (int Eingabe3,float Eingabe1,float Eingabe2,float Ergebnis)
{
if (Eingabe3 == 1)
	{
	Ergebnis = float plus (float Eingabe1,float Eingabe2,float Ergebnis)
	}
	else if (Eingabe3 == 2)
		{
		Ergebnis = float minus (float Eingabe1,float Eingabe2,float Ergebnis)
		}
		else if (Eingabe3 == 3)
			{
			Ergebnis = float geteilt (float Eingabe1,float Eingabe2,float Ergebnis)
			}
			else if (Eingabe3 == 4)
				{
				Ergebnis = float mal (float Eingabe1,float Eingabe2,float Ergebnis)
				}
				else if (Eingabe3 == 5)
					{
					Ergebnis = float rest (float Eingabe1,float Eingabe2,float Ergebnis,int Eingabe1ganz,int Eingabe2´ganz)
					}
if ( defOperator == 1 )
		{cout &lt;&lt; &quot;Das Ergebnis ist: &quot; &lt;&lt; Ergebnis &lt;&lt; &quot;\a&quot; &lt;&lt; endl;}
	else
		Ergebnis = 0;
	cin &gt;&gt; Ende;
}
</code></pre>
<p>Diese Meldungen kommen beim kompilieren:<br />
1.cpp(11) : warning C4101: 'Eingabe2ganz': Unreferenzierte lokale Variable<br />
1.cpp(11) : warning C4101: 'Eingabe1ganz': Unreferenzierte lokale Variable<br />
1.cpp(110) : error C2062: 'float'-Typ unerwartet<br />
1.cpp(114) : error C2062: 'float'-Typ unerwartet<br />
1.cpp(118) : error C2062: 'float'-Typ unerwartet<br />
1.cpp(122) : error C2062: 'float'-Typ unerwartet<br />
1.cpp(126) : error C2062: 'float'-Typ unerwartet</p>
<p>Abgesehen von den ersten beiden Warnungen habe ich keine Ahnung was die Meldungen bedeuten , und auf den Seiten hier ist die Lösung immer irgendein Semikolon Fehler, davon habe ich hier aber keinen gfunden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2283953</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2283953</guid><dc:creator><![CDATA[frcroth]]></dc:creator><pubDate>Fri, 28 Dec 2012 13:38:07 GMT</pubDate></item><item><title><![CDATA[Reply to Feher C2062, Hilfe! on Fri, 28 Dec 2012 13:59:27 GMT]]></title><description><![CDATA[<p>Du solltest dich nochmal mit dem Kapitel Funktionen auseinandersetzen.<br />
Wie und wo deklariert man die Protoypen?<br />
Wie werden Funktionen aufgerufen?</p>
<p>Und es heißt int main() {}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2283957</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2283957</guid><dc:creator><![CDATA[eddi0815]]></dc:creator><pubDate>Fri, 28 Dec 2012 13:59:27 GMT</pubDate></item><item><title><![CDATA[Reply to Feher C2062, Hilfe! on Fri, 28 Dec 2012 13:56:57 GMT]]></title><description><![CDATA[<p>wie gesagt du kanst main nicht als float deklarieren!<br />
Das ist immer ein integer, du kannst die main funktion eh nicht aufrufen, da kommt auch nur eine fehlermeldung!</p>
<p>Kleiner tipp <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="😉"
    /><br />
ich würde die Variablen nicht global deklarieren!</p>
<p>gruß<br />
coco</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2283960</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2283960</guid><dc:creator><![CDATA[CocoEi]]></dc:creator><pubDate>Fri, 28 Dec 2012 13:56:57 GMT</pubDate></item><item><title><![CDATA[Reply to Feher C2062, Hilfe! on Fri, 28 Dec 2012 16:48:04 GMT]]></title><description><![CDATA[<p>[quote=&quot;CocoEi&quot;Kleiner tipp <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="😉"
    /><br />
ich würde die Variablen nicht global deklarieren![/quote]<br />
Funktionsdeklarationen (Prototypen) aber schon.<br />
Die haben in einer Funktion nichts zu suchen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2284015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2284015</guid><dc:creator><![CDATA[DirkB]]></dc:creator><pubDate>Fri, 28 Dec 2012 16:48:04 GMT</pubDate></item><item><title><![CDATA[Reply to Feher C2062, Hilfe! on Fri, 28 Dec 2012 18:24:15 GMT]]></title><description><![CDATA[<pre><code>float Ergebnis;
// noch ganz viel cod dazwischen
void ergebnis (int Eingabe3,float Eingabe1,float Eingabe2,float Ergebnis)
</code></pre>
<p>ich weiß nicht was du daran als Prototyp ansiehst <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>
<p>außerdem</p>
<pre><code>int Ende;
</code></pre>
<p>find ich auch nirgends unter den functionen!?</p>
<p>oder vergucke ich mich <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":O"
      alt="😮"
    /></p>
<p>gruß<br />
coco</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2284063</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2284063</guid><dc:creator><![CDATA[CocoEi]]></dc:creator><pubDate>Fri, 28 Dec 2012 18:24:15 GMT</pubDate></item><item><title><![CDATA[Reply to Feher C2062, Hilfe! on Fri, 28 Dec 2012 18:53:36 GMT]]></title><description><![CDATA[<p>Das war keine Kritik an deinem Tipp, sondern eine Ergänzung.</p>
<p>Variablen lokal, Funktionen global.</p>
<p>Oder was hältst du von den Zeilen 12 bis 18?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2284067</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2284067</guid><dc:creator><![CDATA[DirkB]]></dc:creator><pubDate>Fri, 28 Dec 2012 18:53:36 GMT</pubDate></item><item><title><![CDATA[Reply to Feher C2062, Hilfe! on Sat, 29 Dec 2012 11:15:12 GMT]]></title><description><![CDATA[<p>ja genau so meinte ich das <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>
<p>gruß<br />
coco</p>
<p>ps: habe ich auch nicht als kritik empfunden dachte nur du hast mich falsch verstanden <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="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2284189</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2284189</guid><dc:creator><![CDATA[CocoEi]]></dc:creator><pubDate>Sat, 29 Dec 2012 11:15:12 GMT</pubDate></item></channel></rss>