••• Unprocessable paragraph: \start
Home Segments Index Top Previous Next

589: Mainline


••• Unprocessable paragraph: You can, if you wish, display a floating-point number without the fractional part by converting it to an integer using \cpp/'s casting mechanism. As you learned in \unitref\Xperform/, all you need to do is to preface the number with \code{(int)}, as in the following illustration: \begincode printf ("\noshow \result ! box 4703 box 4703.8 \endcode The result is: \begincode box 4703 \endcode A better approach is to use the \code{following example: \begincode field width | v printf (" ^ | number of digits to appear in the number's fractional part \endcode Again, the result is: \begincode box 4703 \endcode The \code{and other data types, is explained more fully in \appendixref\B/. \par C:\Phw\Onto\CPP\formatc.tex ••• C:\Phw\Onto\CPP\formatc.tex •••