第10课 古埃及金字塔 《小学生C++趣味编程》

#include<iostream>
using namespace std;
int main()
{
	int a,h;
	//float的精度没有double的高
	//float单精度 double双精度
	//浮点型:单精度 双精度 
	//float  s;
	double s;
	
	cout<<"a,h=";
	cin>>a>>h;
	//a*h 不能保证是2的倍数 
	//s=a*h/2.0;
	//s=a*h*1.0/2;
	//s=a*h/2.0;  //这里要写实数2.0,不能写成整数2
	cout<<a*h/2.0<<endl;   
	
	return 0;
}

 


 

 

猜你喜欢

转载自blog.csdn.net/dllglvzhenfeng/article/details/121809003