正在加载图片...
第2部分 cout<<"The radius of the first cylinder is: \t'"<<cylinder. getradius( <<endl cout<<"The height of the first cylinder is: \t"<<cylinder. getheighto<<endl; cout<<"The volume of the first cylinder is: \ t"<<cylinder volume<<endl cout<<"The surface area of the first cylinder is: \ t"<<cylindersurface areao cout<<"The radius of the second cylinder is:\ t"<<cylinder2. getradiusO<<endl; cout<<"The height of the second cylinderis: t"<<cylinder2. getheighto<<endl; cout<<"The volume of the second cylinderis: \t"<<cylinder2 volume<<endl; cout<<"The surface area of the second cylinder is:\t cylinder2 surface area(<<endl 系统在创建每一个对象时都需要自动调用相应的构造函数 注自动生成的默认构造函数不带任何参数,在函数体内也没有任何 语句,不执行任何操作。 其形式如下:类名::类名() (续)注 自动生成的默认构造函数不带任何参数,在函数体内也没有任何 语句,不执行任何操作。 cout<< ″The radius of the first cylinder is:\t″<<cylinder1.getradius()<<endl; cout<< ″The height of the first cylinder is:\t ″<<cylinder1.getheight()<<endl; cout<< ″The volume of the first cylinder is:\t ″<<cylinder1.volume()<<endl; cout<< ″The surface area of the first cylinder is:\t ″<<cylinder1.surface_area()<<endl; cout<< ″The radius of the second cylinder is:\t ″<<cylinder2.getradius()<<endl; cout<< ″The height of the second cylinder is:\t ″<<cylinder2.getheight()<<endl; cout<< ″The volume of the second cylinder is:\t ″<<cylinder2.volume()<<endl; cout<< ″The surface area of the second cylinder is:\t ″<<cylinder2.surface_area()<<endl; } 第2部分 系统在创建每一个对象时都需要自动调用相应的构造函数。 其形式如下:类名::类名() {} (续)
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有