标签:style blog io color os sp for div log
1 #include <iostream> 2 3 #define TIMES 10 4 5 int 6 main(void) { 7 float sumHeight = 100; 8 float bouceHeight = sumHeight / 2; //第一次反弹的高度. 9 for(int i = 2; i <= TIMES; i++) { 10 sumHeight += 2 * bouceHeight; //第i次经过的距离. 11 bouceHeight /= 2; //第i次即将反弹的高度. 12 } 13 printf("第%d次落地时经过:%g 米,反弹高度为:%g",TIMES, sumHeight, bouceHeight); 14 //第10次落地时经过:299.609 米,反弹高度为:0.0976563 15 }
标签:style blog io color os sp for div log
原文地址:http://www.cnblogs.com/listened/p/4139435.html