资讯详情

使用c++,类实现求圆柱体体积

代码展示:

#include <iostream> using namespace std; class cylinder {  public:   cylinder (double r,double h);   void vol();  private:    double r1,h1; }; void cylinder::vol() {  double volume;    volume=3.14*r1*r1*h1;       cout<<volume<<endl; } cylinder::cylinder(double r,double h) {  r1=r;  h1=h; } int main() {  cylinder c1(2,3);  c1.vol();  return 0; }

标签: 圆柱形对射激光传感器m12im8圆柱型接近传感器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台