<?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[menu erstellen]]></title><description><![CDATA[<p>hi,<br />
ich wollte fragen, ob ich Menü geschickter schreiben kann. Mein Programm funktioniert gut, aber würde gerne über andere Möglichkeiten erfahren.</p>
<p>Hier mein Beispielcode:</p>
<pre><code>#include &lt;stdafx.h&gt;
using namespace std;

int main() {

	int mode = 0;
	string str;
	cout &lt;&lt; &quot;Eingabe: &quot;;
	cin &gt;&gt; mode;

	switch (mode) {

		case 1 : str = &quot;mean&quot;;
			break;	

		case 2 : str = &quot;var&quot;;
			break;

		default : cout &lt;&lt; &quot;Keine gueltige eingabe. \n&quot;;
	}

        outFile( str) ;
	cout &lt;&lt; &quot;\nfine&quot; &lt;&lt; '\n';

	char k;
	std::cin &gt;&gt; k;

	return 0;
}

std::vector&lt;double&gt; outFile( string s) 
{
	std::vector&lt;double&gt; res;
	if( s == &quot;mean&quot; ){
		cout &lt;&lt; &quot;funktion 1&quot; &lt;&lt; '\n';
	}else if ( s == &quot;var&quot; ){ 

		cout &lt;&lt; &quot;funktion 2&quot; &lt;&lt; '\n';
	}else 
		cout &lt;&lt; &quot;keine gueltige ausgabe&quot; &lt;&lt; '\n';

	return res;
}
</code></pre>
<p>gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/266429/menu-erstellen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 07:14:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/266429.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 08 May 2010 20:23:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to menu erstellen on Sat, 08 May 2010 20:23:42 GMT]]></title><description><![CDATA[<p>hi,<br />
ich wollte fragen, ob ich Menü geschickter schreiben kann. Mein Programm funktioniert gut, aber würde gerne über andere Möglichkeiten erfahren.</p>
<p>Hier mein Beispielcode:</p>
<pre><code>#include &lt;stdafx.h&gt;
using namespace std;

int main() {

	int mode = 0;
	string str;
	cout &lt;&lt; &quot;Eingabe: &quot;;
	cin &gt;&gt; mode;

	switch (mode) {

		case 1 : str = &quot;mean&quot;;
			break;	

		case 2 : str = &quot;var&quot;;
			break;

		default : cout &lt;&lt; &quot;Keine gueltige eingabe. \n&quot;;
	}

        outFile( str) ;
	cout &lt;&lt; &quot;\nfine&quot; &lt;&lt; '\n';

	char k;
	std::cin &gt;&gt; k;

	return 0;
}

std::vector&lt;double&gt; outFile( string s) 
{
	std::vector&lt;double&gt; res;
	if( s == &quot;mean&quot; ){
		cout &lt;&lt; &quot;funktion 1&quot; &lt;&lt; '\n';
	}else if ( s == &quot;var&quot; ){ 

		cout &lt;&lt; &quot;funktion 2&quot; &lt;&lt; '\n';
	}else 
		cout &lt;&lt; &quot;keine gueltige ausgabe&quot; &lt;&lt; '\n';

	return res;
}
</code></pre>
<p>gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1894416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1894416</guid><dc:creator><![CDATA[apfelmaennchen]]></dc:creator><pubDate>Sat, 08 May 2010 20:23:42 GMT</pubDate></item><item><title><![CDATA[Reply to menu erstellen on Sun, 09 May 2010 04:59:40 GMT]]></title><description><![CDATA[<p>Hi apfelmaennchen,</p>
<p>die Konvertierung von int nach string macht wenig Sinn.<br />
Du kannst genauso gut outFile(int) benutzen.<br />
Vielleicht hast du es so gemacht, weil du in deinem Programm später<br />
eine inhaltliche Beziehung zwischen Variable und Wert wolltest.<br />
Denk mal über Konstanten nach.</p>
<p>Eine andere Frage: Warum verwendest du manchmal std:: und manchmal<br />
nicht?<br />
Ich persönlich bin kein Fan von: using namespace std;<br />
Aber wenn du es benutzt, kannst du das std:: auch immer weglassen.<br />
bevor Einspruch kommt: Du könntest es (glaub ich) nicht weglassen, wenn du<br />
namespaces benutzt, die den gleichen Klassennamen haben.</p>
<p>Gruß,<br />
CSpille</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1894500</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1894500</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 09 May 2010 04:59:40 GMT</pubDate></item></channel></rss>