<?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[Problem mit Funktionen]]></title><description><![CDATA[<p>HAllo ich hab ein Programm entwickelt womit man Funtionen berechen kann, aber der Compiler sagt immer eine Variable wurde zwei mal deklariert.<br />
Code:</p>
<pre><code class="language-cpp">1:#include &lt;iostream&gt;
2:int Radius(int d);           //Funktion für Radius
3:int Durchmesser(int r);      //Funktion für Durchmesser
4:
5:
6:
7:
8:
9:int main()
10:{
11:   int Function;
12:
13:
14:  std::cout &lt;&lt; &quot;Was wollen sie suchen ? \n&quot;;             //Here I make a menu15
15:  std::cout &lt;&lt; &quot; Radius = 1, Durchmesser = 2 \n&quot;;        //and ask what they want calculate.
16:  std::cout &lt;&lt; &quot;Geben sie die jeweilige Zahl an : \n&quot;;
17:  std::cin.get();
18:  if ( Function == 1)            // chooses selection of person
19:  { if ( Function == 2)         // and changes it to the function needed
20:    int Durchmesser();
21:  }
22:  else
23:  int Radius();
24:
25:    return 0;
26:}
27:
28:#include &lt;iostream&gt;
29:
30:int Radius()
31:{
32:  int d;
33  int r;
34:  std::cout &lt;&lt; &quot;Wie groß ist der Durchmesser (d)? \n&quot;;
35:  std::cin &gt;&gt; d;
36:  std::cout &lt;&lt; &quot;Der Radius ist :&quot; &lt;&lt; r = d/2;
37:  return d;
38:  return 0;
39:}
40:
41:#include &lt;iostream&gt;
42:
43:int Durchmesser(int r)
44:{
45:  int r;
46:  int d;
47:
48:  std::cout &lt;&lt; &quot;Wie groß ist der Radius (r) ? \n&quot;;
49:  std::cin &gt;&gt; r;
50:  std::cout &lt;&lt; &quot;Der Durchmesser ist :&quot; &lt;&lt; d= r*2;
51:  return d;
52:  return 0;
53:}
</code></pre>
<p>Fehlermeldungen:<br />
&quot;New.cpp&quot;: E2285 Keine Übereinstimmung für '_STL::ostream::operator =(int)' gefunden in Funktion Radius() in Zeile 36<br />
&quot;New.cpp&quot;: E2238 Bezeichner 'r' mehrfach deklariert in Funktion Durchmesser(int) in Zeile 44<br />
&quot;New.cpp&quot;: E2314 Aufruf einer Nicht-Funktion in Funktion Durchmesser(int) in Zeile 48<br />
&quot;New.cpp&quot;: E2285 Keine Übereinstimmung für '_STL::ostream::operator =(int)' gefunden in Funktion Durchmesser(int) in Zeile 49</p>
<p>[edit=&quot;junix&quot;]Bitte Code-Tags verwenden![/edit]</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/109657/problem-mit-funktionen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 10:29:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/109657.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 12 May 2005 07:52:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit Funktionen on Thu, 12 May 2005 08:39:32 GMT]]></title><description><![CDATA[<p>HAllo ich hab ein Programm entwickelt womit man Funtionen berechen kann, aber der Compiler sagt immer eine Variable wurde zwei mal deklariert.<br />
Code:</p>
<pre><code class="language-cpp">1:#include &lt;iostream&gt;
2:int Radius(int d);           //Funktion für Radius
3:int Durchmesser(int r);      //Funktion für Durchmesser
4:
5:
6:
7:
8:
9:int main()
10:{
11:   int Function;
12:
13:
14:  std::cout &lt;&lt; &quot;Was wollen sie suchen ? \n&quot;;             //Here I make a menu15
15:  std::cout &lt;&lt; &quot; Radius = 1, Durchmesser = 2 \n&quot;;        //and ask what they want calculate.
16:  std::cout &lt;&lt; &quot;Geben sie die jeweilige Zahl an : \n&quot;;
17:  std::cin.get();
18:  if ( Function == 1)            // chooses selection of person
19:  { if ( Function == 2)         // and changes it to the function needed
20:    int Durchmesser();
21:  }
22:  else
23:  int Radius();
24:
25:    return 0;
26:}
27:
28:#include &lt;iostream&gt;
29:
30:int Radius()
31:{
32:  int d;
33  int r;
34:  std::cout &lt;&lt; &quot;Wie groß ist der Durchmesser (d)? \n&quot;;
35:  std::cin &gt;&gt; d;
36:  std::cout &lt;&lt; &quot;Der Radius ist :&quot; &lt;&lt; r = d/2;
37:  return d;
38:  return 0;
39:}
40:
41:#include &lt;iostream&gt;
42:
43:int Durchmesser(int r)
44:{
45:  int r;
46:  int d;
47:
48:  std::cout &lt;&lt; &quot;Wie groß ist der Radius (r) ? \n&quot;;
49:  std::cin &gt;&gt; r;
50:  std::cout &lt;&lt; &quot;Der Durchmesser ist :&quot; &lt;&lt; d= r*2;
51:  return d;
52:  return 0;
53:}
</code></pre>
<p>Fehlermeldungen:<br />
&quot;New.cpp&quot;: E2285 Keine Übereinstimmung für '_STL::ostream::operator =(int)' gefunden in Funktion Radius() in Zeile 36<br />
&quot;New.cpp&quot;: E2238 Bezeichner 'r' mehrfach deklariert in Funktion Durchmesser(int) in Zeile 44<br />
&quot;New.cpp&quot;: E2314 Aufruf einer Nicht-Funktion in Funktion Durchmesser(int) in Zeile 48<br />
&quot;New.cpp&quot;: E2285 Keine Übereinstimmung für '_STL::ostream::operator =(int)' gefunden in Funktion Durchmesser(int) in Zeile 49</p>
<p>[edit=&quot;junix&quot;]Bitte Code-Tags verwenden![/edit]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/787125</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/787125</guid><dc:creator><![CDATA[Jeronimo Mc Kinsley]]></dc:creator><pubDate>Thu, 12 May 2005 08:39:32 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Funktionen on Thu, 12 May 2005 08:01:30 GMT]]></title><description><![CDATA[<p>Oh mann, das kann ja heiter werden...<br />
Zuerst deklarierst du den Funktions-Prototypen int Radius(int d);, definierst dann aber die Funktion int Radius();?</p>
<p>Und was die Fehlermeldungen angeht: Die Zeilenangabe steht doch sogar schon dabei! Schau dir die Zeilen doch mal an, dann weißt du auch, was da falsch ist!</p>
<p>Jede Fehlermeldung sagt dir schon, was los ist:<br />
Du kannst keine Variable zwei mal deklarieren!<br />
int Durchmesser(<strong>int r</strong>)<br />
44:{<br />
45: <strong>int r;</strong></p>
<p>EDIT:<br />
Und wieso steht in jeder der beiden Funktionen:</p>
<pre><code class="language-cpp">return d;
return 0;
</code></pre>
<p>?<br />
Du kannst nur EINEN Wert &quot;return&quot;en, und dann ist die Funktion auch beendet!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/787128</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/787128</guid><dc:creator><![CDATA[Reyx]]></dc:creator><pubDate>Thu, 12 May 2005 08:01:30 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Funktionen on Thu, 12 May 2005 08:02:12 GMT]]></title><description><![CDATA[<p>ui.. wo fängt man da an?<br />
1. Code-Tags verwenden <a href="http://www.c-plusplus.net/forum/faq.php?mode=bbcode" rel="nofollow">http://www.c-plusplus.net/forum/faq.php?mode=bbcode</a></p>
<ol start="2">
<li></li>
</ol>
<blockquote>
<p>&quot;New.cpp&quot;: E2285 Keine Übereinstimmung für '_STL::ostream::operator =(int)' gefunden in Funktion Radius() in Zeile 36</p>
</blockquote>
<pre><code class="language-cpp">2:int Radius(int d); //Funktion für Radius 
23: int Radius(); 
30:int Radius()
31:{
</code></pre>
<p>überlege mal, was stimmt hier nicht?</p>
<p>3.</p>
<blockquote>
<p>&quot;New.cpp&quot;: E2238 Bezeichner 'r' mehrfach deklariert in Funktion Durchmesser(int) in Zeile 44</p>
</blockquote>
<pre><code class="language-cpp">43:int Durchmesser(int r)
44:{
45: int r;
46: int d; 
47: ...
</code></pre>
<p>und hier?</p>
<p>habe nicht alles durchgeschaut, aber sieht nach mehreren grundlegenden fehlern aus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/787130</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/787130</guid><dc:creator><![CDATA[BigNeal]]></dc:creator><pubDate>Thu, 12 May 2005 08:02:12 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Funktionen on Thu, 12 May 2005 08:14:47 GMT]]></title><description><![CDATA[<p>grob verbesert.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
int Radius(); //Funktion für Radius
int Durchmesser(); //Funktion für Durchmesser
int main()
{
 int Function;
 std::cout &lt;&lt; &quot;Was wollen sie suchen ? \n&quot;; //Here I make a menu15
 std::cout &lt;&lt; &quot; Radius = 1, Durchmesser = 2 \n&quot;; //and ask what they want calculate.
 std::cout &lt;&lt; &quot;Geben sie die jeweilige Zahl an : \n&quot;;
 std::cin &gt;&gt; Function;
 switch(Function)
 {
 case 1:Radius();break;
 case 2:Durchmesser();break;
 }
return 0;
}
int Radius()
{
int r;
int d;
 std::cout &lt;&lt; &quot;Wie groß ist der Durchmesser (d)? \n&quot;;
 std::cin &gt;&gt; d;
 std::cout &lt;&lt; &quot;Der Radius ist :&quot; &lt;&lt; (r = d/2);
 return r;
}
int Durchmesser()
{
 int d;
 int r;
 std::cout &lt;&lt; &quot;Wie groß ist der Radius (r) ? \n&quot;;
 std::cin &gt;&gt; r;
 std::cout &lt;&lt; &quot;Der Durchmesser ist :&quot; &lt;&lt; (d= r*2);
 return d;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/787138</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/787138</guid><dc:creator><![CDATA[x_y]]></dc:creator><pubDate>Thu, 12 May 2005 08:14:47 GMT</pubDate></item></channel></rss>