82 421
Assignments Done
100%
Successfully Done
In January 2020

# Answer to Question #10867 in C++ for Jo

Question #10867
The program below (in C not in C++) reads a double before calling the chop function, which has the following prototype: void chop(double d, long *whole_part, double *fraction_part); This function chops the double into two parts, the whole part and the fraction. So &ldquo;365.25&rdquo; would be chopped into &ldquo;365&rdquo; and &ldquo;.25&rdquo;. Implement the function. #include &lt;stdio.h&gt; #include &lt;math.h&gt; #include &lt;limits.h&gt; void chop(double d, long *whole_part, double *fraction_part); int main(void) { double d = 0.0; long whole = 0; double fraction = 0.0; printf(&quot;enter a double &quot;); scanf(&quot;%lf&quot;, &d); chop(d, &whole, &fraction); printf(&quot;%lf chopped is %ld and %.5lg\n&quot;, d, whole, fraction); return 0; } void chop(double d, long *whole_part, double *fraction_part) { Insert the function here }
1
2012-11-12T08:16:33-0500
int main(void)
{
& double d = 1.5;
& double i = 0;
& double f = modf(d, &i);
& printf(&quot;Number = %g\n&quot;, d);
& printf(&quot;Integer part = %g, fractional part = %g\n&quot;, i, f);
& return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!