int main(int argc, char const *argv[]) { Curve3D curve; ofstream tos("out.txt"); ofstream bos("out.bin", ios::binary); ifstream tis("in.txt"); ifstream bis("in.txt", ios::binary); int x, y, z; int choice; int flag = 1; while (flag) { PrintTable(); cin >> choice; switch (choice) { case(0) : flag = 0; break; case(1) : curve.DisplayCurve(); break; case(2) : cout << "Please input x, y and z of the new point(splite by space):"; cin >> x >> y >> z; curve = curve + Point3D(x, y, z); break; case(3) : cout << "Please input x, y and z of the point to delete(splite by space):"; cin >> x >> y >> z; curve = curve - Point3D(x, y, z); break; case(4) : curve.CurveLen(); break; case(5) : curve.write_txt(tos); break; case(6) : curve.read_txt(tis); break; case(7) : curve.write_bin(bos); break; case(8) : curve.read_bin(bis); break; default: break; } } tos.close(); bos.close(); tis.close(); bis.close(); return 0; }
int main() { #ifdef QWERTIER freopen("in.txt","r",stdin); #endif Curve3D x; Point3D p1(1,2,3); Point3D p2(4, 5, 6); Point3D p3(783274,32487,38787); x.DisplayCurve(); (x + p1).DisplayCurve(); (x + p1 + p2).DisplayCurve(); (x + p1 + p2 + p3).DisplayCurve(); printf("%f\n", (x + p1 + p2 + p3).CurveLen()); return 0; }