Would it be possible that I forgot something?
<pre><code>string str;
int i = 0, counter = 0;
cin &gt;&gt; str;
do
{
    if(str[i] &gt;= 'A' &amp;&amp; str[i] &lt;= 'Z')counter++;
    cout &lt;&lt; "Yes";
    i++;

}while(str[i] != '\0');
</code></pre>

<p>A piece of code that takes a string from a user and outputs one single "Yes" if there are any capitals otherwise output nothing. This is from my test and I did not completely fulfill what was require in the instruction. </p>

<p>It works, but then when I type like "HHi" it will output "YesYes" when it should only be "Yes".</p>

<p>How can I ensure it only prints one "Yes" when it finds any amount of capitals?</p>