Advertisement
nickparker

Untitled

Jun 26th, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. // slicer2.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "iostream"
  6. #include <list>
  7. using namespace std;
  8. enum class axis{ x, y, z };
  9.  
  10. int _tmain(int argc, _TCHAR* argv[])
  11. {
  12.     point p1();
  13.     point p2(0, 3, 4);
  14.     double val = delx(p1, p2);
  15.     std::cout << val;
  16.  
  17. }
  18. class point{
  19. private:
  20.     double xc;
  21.     double yc;
  22.     double zc;
  23. public:
  24.     point(double xin, double yin, double zin) {
  25.         xc = xin;
  26.         yc = yin;
  27.         zc = zin;
  28.     }
  29.     point(){
  30.         xc = 0;
  31.         yc = 0;
  32.         zc = 0;
  33.     }
  34.     double getval(axis a){
  35.         switch (a){
  36.         case axis::x:{
  37.             return xc;
  38.         }
  39.         case axis::y:{
  40.             return yc;
  41.         }
  42.         case axis::z:{
  43.             return zc;
  44.         }
  45.         }
  46.     }
  47. };
  48. double delx(point a, point b){
  49.     return a.getval(axis::x) - b.getval(axis::x);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement