3.1

学习《c++ primer plus第六版》也有一段时间了,今天开始把课后写的代码传到博客上来,也算是开始写博客了吧。

#include<iostream>

int main()
{
	using namespace std;
	
	const double transition = 12;
	double inch_height;
	double foot_height;
	int t_inch_height;

	cout << "Please enter your height(inch),and this program will transform it to foot and inch : _____.\b\b\b\b\b\b" ;
	cin >> inch_height;
	t_inch_height = int(inch_height)*transition;
	foot_height = (inch_height - int(inch_height))*transition;
	cout << "Your height is " << t_inch_height << " inches and " << foot_height << " feet\n";
	
	return 0;
}


你可能感兴趣的:(C++)