20.cpp

来自「经典C语言程序设计100例1-10 如【程序1】 题目:有1、2、3、4」· C++ 代码 · 共 25 行

CPP
25
字号
/*---------------------------------------例题20-------------------------------------------------------------------*/


#include <iostream>

using namespace std;

int main()
{
	float hight = 100;
	float total_hight = hight;

	for(int i = 2; i<=10; i ++)
	{
		hight /= 2.0;
		total_hight += 2 * hight;
	}
	
	cout<<"The total distances is:"<<total_hight<<endl;
	cout<<"The hight is the tenth round is :"<<hight / 2<<endl;

	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?