PageRenderTime 26ms CodeModel.GetById 19ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1.3.35/Examples/python/shadow/example.cxx

#
C++ | 31 lines | 22 code | 7 blank | 2 comment | 0 complexity | ced69823d71d68c9039f00cbb32783be MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1/* File : example.c */
 2
 3#include "example.h"
 4#include <math.h>
 5#ifndef M_PI
 6#  define M_PI 3.14159265358979323846
 7#endif
 8
 9/* Move the shape to a new location */
10void Shape::move(double dx, double dy) {
11  x += dx;
12  y += dy;
13}
14
15int Shape::nshapes = 0;
16
17double Circle::area() {
18  return M_PI*radius*radius;
19}
20
21double Circle::perimeter() {
22  return 2*M_PI*radius;
23}
24
25double Square::area() {
26  return width*width;
27}
28
29double Square::perimeter() {
30  return 4*width;
31}