Exemple #1
0
int main(int argc, const char * argv[]) {
    double meters = 3.0;
    unsigned int feet;
    double inches;
    
    metersToFeetAndInches(meters, &feet, &inches);
    printf("%.1f meters is equal to %d feet and %.1f inches.", meters, feet, inches);
    
    return 0;
}
Exemple #2
0
int main(int argc, char const *argv[])
{
	double pi = 3.14;
	double integerPart;
	double fractionPart;

	//将integerPart的地址作为实参传入
	fractionPart = modf(pi, &integerPart);
	printf("integerPart = %.0f , fractionPart = %.2f\n", integerPart, fractionPart);

	double meters = 3.0 ;
	unsigned int feet ;
	double inches;

	metersToFeetAndInches(meters, &feet, &inches);
	printf("%.1f meters is eques to %d feet and %.1f inches.\n", meters, feet , inches );

	return 0;
}