Solidity Shape Calculator Contract: Rectangle Area and Perimeter
pragma solidity >=0.4.0 <0.6.0;
/**
- @title Shape calculator.
/
contract ShapeCalculator {
/*
- @dev Calculates a rectangle's surface and perimeter.
- @param w Width of the rectangle.
- @param h Height of the rectangle.
- @return s The calculated surface.
- @return p The calculated perimeter. */ function rectangle(uint w, uint h) public pure returns (uint s, uint p) { s = w * h; p = 2 * (w + h); } }
原文地址: http://www.cveoy.top/t/topic/z4z 著作权归作者所有。请勿转载和采集!