cprimer_study/c04_string/floats.c
2023-12-05 21:04:08 +08:00

19 lines
466 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* floats.c - 一些浮点型修饰符的组合 */
#include <stdio.h>
int main(void)
{
const double RENT = 3852.99; // const变量只读变量不是常量
printf("*%f*\n", RENT);
printf("*%e*\n", RENT);
printf("*%4.2f*\n", RENT);
printf("*%3.1f*\n", RENT);
printf("*%10.3f*\n", RENT);
printf("*%10.3E*\n", RENT);
printf("*%+4.2f*\n", RENT);
printf("*%+10.2f*\n", RENT);
printf("*%010.2f*\n", RENT);
return 0;
}