How to calculate number of digits before and after decimal point?
<p>Today a question was asked in my c++ class test. "Write a program that inputs a floating point number and calculates the number of digits before and after decimal point."</p>

<p>I calculated numbers before decimal points with this code:</p>

<pre><code>float n;

cin&gt;&gt;n;

float temp = n;

int count = 0;

while(temp1 &gt; 1) {

    count++;

    temp = temp/10;
}

cout&lt;&lt;count;
</code></pre>

<p>but I stuck with after part. Can anyone tell me how to do this? or can provide the whole program?</p>

<p>Thanks in advance,</p>