标签:
int main() { int64_t test = 100; printf("%lld\n",test); float f_test = 100.2123; printf("%f\n",f_test); scanf("%f",&f_test); printf("%f\n",f_test);
}
格式输出浮点
double shoes = 10.23; printf("%-10.2f ok\n",shoes); printf("%-15.2f ok\n",shoes); printf("%10.2f ok\n",shoes); printf("%15.2f ok\n",shoes); printf("%.2f ok\n",shoes); printf("%.6f ok\n",shoes); printf("%.2ef ok\n",shoes);
整数空格输出 ,下面控制前面5个空格
如果是%-5d,就是右对齐。上面的float输出也是一样的
int index = 0 ; while(++index < 5) { printf("%5d \n",index); } return 0;
标签:
原文地址:http://www.cnblogs.com/gearslogy/p/5406130.html