swig/Examples/php4/shadow/example.cxx
William S Fulton 91578e4033 Define M_PI if not defined in math.h
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4558 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-03-17 10:29:35 +00:00

31 lines
478 B
C++

/* File : example.c */
#include "example.h"
#include <math.h>
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
/* Move the shape to a new location */
void Shape::move(double dx, double dy) {
x += dx;
y += dy;
}
int Shape::nshapes = 0;
double Circle::area(void) {
return M_PI*radius*radius;
}
double Circle::perimeter(void) {
return 2*M_PI*radius;
}
double Square::area(void) {
return width*width;
}
double Square::perimeter(void) {
return 4*width;
}