// Compile using g++ assignment1.cpp -lgmpxx -lgmp #include "dpoint.hpp" #include #include ////////////////////////////////////////////////// // The manual for gmp can be found at: // http://www.swox.com/gmp/gmp-man-4.1.4.pdf ////////////////////////////////////////////////// // Why is it necessary to add this function? mpq_class sqrt(mpq_class x){ double dx = x.get_d(); double sdx = sqrt(dx); mpq_class yy(sdx); return yy; } typedef _cg::dpoint Point; int main(void){ mpq_class x1(1.3), y1(2.3); mpq_class x2(1.32), y2(2.31); mpq_class x3(1.31), y3(2.31); Point P[3]; P[0][0] = x1; P[0][1] = y1; P[1][0] = x2; P[1][1] = y2; P[2][0] = x3; P[2][1] = y1; std::cout << orientation(P) << std::endl; std::cout << orientation(P[0],P[1],P[2]) << std::endl; return 0; }