?C++?,????printf?????????????????????????????:
- ??%f????????,??:
double num = 3.14159; printf("The value of num is %f\n", num);
- ??????????,???%f???.???????,??:
double num = 3.14159; printf("The value of num is %.2f\n", num); // ?????3.14
- ??%e?%E??????????????,??:
double num = 123456.789; printf("The value of num is %e\n", num); // ?????1.234568e+05
- ??????????????,???%f??????,??:
double num = 3.14159; printf("The value of num is .2f\n", num); // ????? 3.14(????10,??????2)
??????,?????????????,????????