<?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[Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?)]]></title><description><![CDATA[<p>Fehler</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/181328/hilfe-benötigt-problem-bei-überprüfung-eines-wertes-globale-variable-oder-in-der-cpp-einer-klasse</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 06:18:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/181328.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 12 May 2007 14:40:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?) on Sun, 10 Jun 2007 22:46:09 GMT]]></title><description><![CDATA[<p>Fehler</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283509</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283509</guid><dc:creator><![CDATA[tw14199]]></dc:creator><pubDate>Sun, 10 Jun 2007 22:46:09 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?) on Sat, 12 May 2007 14:47:06 GMT]]></title><description><![CDATA[<p>Also:<br />
1. Verwende Code-Tags<br />
Hättest du sie verwendet, hätte ich mir sogar deinen Code angeschaut.</p>
<pre><code class="language-cpp">// Drück Zitieren um zu sehen wie´s geht.
</code></pre>
<p>2. Es gibt keine If-Schleifen, höchstens If-Anweisungen.</p>
<p>3. Man kann keine globalen Variablen in main anlegen, das muss man außerhalb machen</p>
<p>Gruß<br />
Don06</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283513</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283513</guid><dc:creator><![CDATA[Don06]]></dc:creator><pubDate>Sat, 12 May 2007 14:47:06 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?) on Sat, 12 May 2007 14:48:46 GMT]]></title><description><![CDATA[<p>Zeig mal deinen ganzen Code ... der soweit man es bisher sieht ziemlich grober Mist ^^ Achja ... wenn du als Return-Value int hast, musst du auch nen int zurückgeben. Nimm void und der meckert nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283515</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283515</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sat, 12 May 2007 14:48:46 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?) on Sun, 10 Jun 2007 22:43:40 GMT]]></title><description><![CDATA[<p>Fehler</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283519</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283519</guid><dc:creator><![CDATA[tw14199]]></dc:creator><pubDate>Sun, 10 Jun 2007 22:43:40 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?) on Sat, 12 May 2007 15:01:52 GMT]]></title><description><![CDATA[<p>Ich glaube, dass sich mehr Leute den Code anschauen würden, wenn du ihn in den entsprechenden Tag ([cpp]) setzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283521</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283521</guid><dc:creator><![CDATA[The-Kenny]]></dc:creator><pubDate>Sat, 12 May 2007 15:01:52 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?) on Sat, 12 May 2007 15:04:17 GMT]]></title><description><![CDATA[<p>Sorry bin zum ersten mal in so einem Forum wie mache ich das?<br />
Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283525</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283525</guid><dc:creator><![CDATA[tw14199]]></dc:creator><pubDate>Sat, 12 May 2007 15:04:17 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?) on Sat, 12 May 2007 15:08:49 GMT]]></title><description><![CDATA[<p>Einfach vor deinen Code</p>
<pre><code class="language-cpp">und nach deinen Code
</code></pre>
<p>setzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283528</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283528</guid><dc:creator><![CDATA[The-Kenny]]></dc:creator><pubDate>Sat, 12 May 2007 15:08:49 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?) on Sat, 12 May 2007 15:19:18 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Kurzbeschreibung</p>
<p>Möchte dann im Programm die Startgebühr abhängig ob jemand Hobbyklasse oder Vereinsläufer ist, ausgeben.</p>
<p>Vereinsläufer soll dann eine Vererbung von Läufer werden und all Attribute und Methoden übernehmen.</p>
<p>Bei der Eingabe der Läufer wir dan gefragt ob jeamand im Verein ist oder nicht.<br />
Wenn ja wird ein entsprechender Wert zu gewissen und dann beim Anzeigen der gesamten Läufer mit auf dem Bildschrim angezeigt.</p>
<p>Hobbläufer soll dann ein Objekt der Klasse LAEUFER werden oder so?............</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283541</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283541</guid><dc:creator><![CDATA[tw14199]]></dc:creator><pubDate>Sat, 12 May 2007 15:19:18 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?) on Sat, 12 May 2007 15:24:33 GMT]]></title><description><![CDATA[<p>nja hab das jetzt nicht nach deiner beschreibung gemacht sondern deinen Code korrigiert/verbessert:</p>
<pre><code class="language-cpp">#if !defined(WALKER_H__INCLUDED)
#define WALKER_H__INCLUDED

#if (_MSC_VER &gt; 1000)
	#pragma once
#endif // (_MSC_VER &gt; 1000)

#include &lt;string&gt;

class Walker
{
public:
	Walker(const unsigned short&amp;, const std::string&amp;, const std::string&amp;, const char, const bool);
	~Walker();

public:
	void	show_data();
	void	set_time(const float&amp; time)	{ m_time = time;	}
	bool	is_hobby_run() const	{ return m_itshobby;	}

private:
	void	calc_payment();

private:
	int				m_startpos;
	std::string		m_prename;
	std::string		m_name;
	char			m_sex;
	float			m_time;
	bool			m_itshobby;
	int				m_payment;
};

#endif // WALKER_H__INCLUDED
</code></pre>
<pre><code class="language-cpp">#include &quot;Walker.h&quot;
#include &lt;iostream&gt;

Walker::Walker(const unsigned short&amp; start_pos, const std::string&amp; prename, const std::string&amp; name, const char sex, const bool hobby_run) :
m_startpos(start_pos), m_prename(prename), m_name(name), m_sex((sex == 'm' ? 'm' : (sex == 'f' ? 'f' : 'n'))), m_itshobby(hobby_run), m_payment(0), m_time(0.0f)
{
	calc_payment();
}

Walker::~Walker()
{
}

void Walker::show_data()
{
	std::cout &lt;&lt; m_prename &lt;&lt; &quot; &quot; &lt;&lt; m_name &lt;&lt; &quot; (&quot; &lt;&lt; m_sex &lt;&lt; &quot;):\n\tStartposition: &quot; &lt;&lt; m_startpos &lt;&lt; &quot;\n\tStartgebuehr: &quot; &lt;&lt; m_payment &lt;&lt; &lt;&lt; &quot;\n\tHobby: &quot; &lt;&lt; m_itshobby &lt;&lt; std::endl;
}

void Walker::calc_payment()
{
	m_payment = (m_sex == 'm' ? 1 : 0); // Mann zahlt 1€ mehr.
	m_payment += (m_itshobby ? 8 : 6); // Hobbyläufer 2€ mehr.
}
</code></pre>
<pre><code class="language-cpp">#include &quot;Walker.h&quot;

int main()
{
	Walker walker(1, &quot;Peter&quot;, &quot;Depp&quot;, 'm', true);
	walker.show_data();
}
</code></pre>
<p>... hab es nicht getestet ... sollte aber gehen <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="🙂"
    /> Könnte hier auch schön den Streamoperator überladen usw ... aber egal. So geht das schonmal <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1283543</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283543</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sat, 12 May 2007 15:24:33 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?) on Sat, 12 May 2007 15:42:10 GMT]]></title><description><![CDATA[<p>cool</p>
<p>Danke fürs erste, werden den Code jetzt mal studieren und meinen anpassen, da ich das ja selber können sollte.</p>
<p>Hast mir aber schon viel geholfen.</p>
<p>Bis dann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283562</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283562</guid><dc:creator><![CDATA[tw14199]]></dc:creator><pubDate>Sat, 12 May 2007 15:42:10 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe benötigt!! Problem bei überprüfung eines Wertes (globale Variable oder in der .cpp einer Klasse?) on Sat, 12 May 2007 15:46:55 GMT]]></title><description><![CDATA[<p>Hmm, nur kurz: bist du dir sicher, dass es Sinn macht, Vereinsläufer abzuleiten, Hobbyläufer aber einfach nur als Variable vom Typ Läufer zu erstellen? Wähle eine von beiden Methoden, aber besser die gleiche für beide.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1283564</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1283564</guid><dc:creator><![CDATA[Shinja]]></dc:creator><pubDate>Sat, 12 May 2007 15:46:55 GMT</pubDate></item></channel></rss>