PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/android/class/jni/example.cpp

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