计算一个房间需要多少张墙纸
											
程序代码:// 计算一个房间需要多少张墙纸
#include<iostream>
using namespace std;
int main()
{
    double height = 0.0,width = 0.0,length = 0.0;             // 房间尺寸,长、宽、高,初始值均为 0
    double perimeter = 0.0;                                   // 房间的周长
    const double rollwidth = 20.0;                            // 墙纸宽
    const double rolllength = 12.0;                           // 墙纸长
    int strips_per_roll = 0;                                  // 一列有多少张
    int strips_reqd = 0;                                      // 有多少列
    int nrolls = 0;                                           // 需要的总张数
    cout << endl;                                            
    cout << "请输入房间的高度 cm:";
    cin >> height;                                            //输入房间高度
    cout << endl;
    cout << "请输入房间的长度和宽度 cm:";
    cin >> length >> width;                                   //输入房间的长和宽
    strips_per_roll =  height / rolllength;                   // 算出每列需要多少张(数据类型转换)
    perimeter = 2.0 * ( length + width);                      // 算出房间的周长
    strips_reqd = perimeter / rollwidth;                      // 算出有多少列(数据类型转换)
    nrolls = strips_reqd * strips_per_roll;                   // 总的需要多少张
    cout << endl;
    cout <<"在垂直方向一列有多少张:"<< strips_per_roll << endl << endl;
    cout <<"房间的周长是: " << perimeter << endl << endl;
    cout <<"在水平方向有多少列:" << strips_reqd << endl << endl;
    cout << "你的房间需要 " << " " << nrolls << " " << "张墙纸。" << endl << endl;
    system("pause");
    return 0;
}
如果照此程序采购墙纸,会有什么结果?如果你是设计人员,如何改进此程序?										
					
	


											
	    

	


