如何將CWgraph控制元件所顯示的曲線,在達到X軸最大值后又從零開始顯示?
uj5u.com熱心網友回復:
修改原始資料x為x1=fmod(x,X軸最大值)fmod
Calculates the floating-point remainder.
double fmod( double x, double y );
Function Required Header Compatibility
fmod <math.h> ANSI, Win 95, Win NT
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version
Return Value
fmod returns the floating-point remainder of x / y. If the value of y is 0.0, fmod returns a quiet NaN. For information about representation of a quiet NaN by the printf family, see printf.
Parameters
x, y
Floating-point values
Remarks
The fmod function calculates the floating-point remainder f of x / y such that x = i * y + f, where i is an integer, f has the same sign as x, and the absolute value of f is less than the absolute value of y.
Example
/* FMOD.C: This program displays a
* floating-point remainder.
*/
#include <math.h>
#include <stdio.h>
void main( void )
{
double w = -10.0, x = 3.0, y = 0.0, z;
z = fmod( x, y );
printf( "The remainder of %.2f / %.2f is %f\n", w, x, z );
printf( "The remainder of %.2f / %.2f is %f\n", x, y, z );
}
Output
The remainder of -10.00 / 3.00 is -1.000000
Floating-Point Support Routines
See Also ceil, fabs, floor
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/108127.html
上一篇:C++中MFC中如何移動圖案?
