Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // slicer2.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include "iostream"
- #include <list>
- using namespace std;
- enum class axis{ x, y, z };
- int _tmain(int argc, _TCHAR* argv[])
- {
- point p1();
- point p2(0, 3, 4);
- double val = delx(p1, p2);
- std::cout << val;
- }
- class point{
- private:
- double xc;
- double yc;
- double zc;
- public:
- point(double xin, double yin, double zin) {
- xc = xin;
- yc = yin;
- zc = zin;
- }
- point(){
- xc = 0;
- yc = 0;
- zc = 0;
- }
- double getval(axis a){
- switch (a){
- case axis::x:{
- return xc;
- }
- case axis::y:{
- return yc;
- }
- case axis::z:{
- return zc;
- }
- }
- }
- };
- double delx(point a, point b){
- return a.getval(axis::x) - b.getval(axis::x);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement