<?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 with a Hello World application]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;iostream&gt;

using namespace std;

int main() {
  string name1;
  char age1;

  do {
    cout &lt;&lt; &quot;What is your name\n&quot;;
    getline (cin, name1 );

    cout &lt;&lt; &quot;What is your age?\n&quot;;
    cin &gt;&gt; age1;
    cin.get();

    if (age1 &gt;= 18)
      cout &lt;&lt; &quot; Hi there &quot; &lt;&lt; name1 &lt;&lt; &quot;, you are allowed to enter.&quot;;
    else
      cout &lt;&lt; &quot;Hi there &quot; &lt;&lt; name1 &lt;&lt; &quot;, Darklink sends you his regards.&quot;;
  }
  while (!isdigit(age1));

  cout &lt;&lt; &quot;\nMade by Mithos Y.\n&quot;;

  cin.get();
  return 0;
}
</code></pre>
<p>this was originally posted by Rascar-Capac on a wrong board...<br />
His problem was that when you enter a letter when de program asks for your age, the program quits...<br />
for some reason this code (wich is edited by on of you guys) doesn't work well <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 />
can someone please help with this one?<br />
greetings,<br />
DL <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/142307/problem-with-a-hello-world-application</link><generator>RSS for Node</generator><lastBuildDate>Tue, 01 Sep 2026 20:02:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/142307.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 29 Mar 2006 13:13:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to problem with a Hello World application on Wed, 29 Mar 2006 13:13:11 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;iostream&gt;

using namespace std;

int main() {
  string name1;
  char age1;

  do {
    cout &lt;&lt; &quot;What is your name\n&quot;;
    getline (cin, name1 );

    cout &lt;&lt; &quot;What is your age?\n&quot;;
    cin &gt;&gt; age1;
    cin.get();

    if (age1 &gt;= 18)
      cout &lt;&lt; &quot; Hi there &quot; &lt;&lt; name1 &lt;&lt; &quot;, you are allowed to enter.&quot;;
    else
      cout &lt;&lt; &quot;Hi there &quot; &lt;&lt; name1 &lt;&lt; &quot;, Darklink sends you his regards.&quot;;
  }
  while (!isdigit(age1));

  cout &lt;&lt; &quot;\nMade by Mithos Y.\n&quot;;

  cin.get();
  return 0;
}
</code></pre>
<p>this was originally posted by Rascar-Capac on a wrong board...<br />
His problem was that when you enter a letter when de program asks for your age, the program quits...<br />
for some reason this code (wich is edited by on of you guys) doesn't work well <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 />
can someone please help with this one?<br />
greetings,<br />
DL <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1026476</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1026476</guid><dc:creator><![CDATA[Darklink]]></dc:creator><pubDate>Wed, 29 Mar 2006 13:13:11 GMT</pubDate></item><item><title><![CDATA[Reply to problem with a Hello World application on Wed, 29 Mar 2006 13:57:42 GMT]]></title><description><![CDATA[<p>Darklink schrieb:</p>
<blockquote>
<pre><code class="language-cpp">if (age1 &gt;= 18)
</code></pre>
</blockquote>
<p>you compare here ascii values</p>
<p>try this without the do/while loop</p>
<pre><code class="language-cpp">int age1 = 0;
// ...
cin &gt;&gt; age1; // if cin fails the value from age is 0
// ...
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1026526</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1026526</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Wed, 29 Mar 2006 13:57:42 GMT</pubDate></item><item><title><![CDATA[Reply to problem with a Hello World application on Thu, 30 Mar 2006 06:25:28 GMT]]></title><description><![CDATA[<p>and after this, you should also check and reset the state of cin to detect any errors inside the user input:</p>
<pre><code class="language-cpp">if(!cin) //an error occured
{
  cerr&lt;&lt;&quot;wrong input\n&quot;;
  cin.clear(); //reset error flags - otherwise cin would ignore any future input requests
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1026898</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1026898</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 30 Mar 2006 06:25:28 GMT</pubDate></item></channel></rss>