running a code after 10 seconds or pressing a key
<p>I am a beginner in c++ , I need to create an application to print some thing after 10 second or after pressing a key , I tried this code but it isn't working(after pressing a key it will print "a" lot of a instead of one "a")</p>

<pre><code>int i;
while(1)
{
    i=1;

    while(!kbhit()||i&lt;1000)
    {
        Sleep(10);
        i++;
    }

    cout&lt;&lt;"a";

}//while1
</code></pre>

<p>Can you suggest me any better way?</p>

<p>Thanks</p>
