fork download
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5.  
  6.  
  7.  
  8. int main()
  9.  
  10.  
  11. {
  12.  
  13.  
  14. cout << "Hello World" << endl;
  15.  
  16.  
  17.  
  18. return 0;
  19.  
  20.  
  21. }
  22.  
  23.  
Success #stdin #stdout 0s 5304KB
stdin
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>

struct Point {
    double x, y;
};

// Function to calculate the distance between two points
double distance(const Point& a, const Point& b) {
    return std::sqrt(std::pow(a.x - b.x, 2) + std::pow(a.y - b.y, 2));
}

// Main function
int main() {
    // Define the points according to the problem statement
    Point O = {0, 0}; // Origin
    Point A = {-4, 7}; // Point on OA
    Point B = {5, 7}; // Point on OB
    Point P = {-1, 3}; // Point P inside angle AOB

    // Calculate the radius for the arc, which is the distance from O to A
    double radius = distance(O, A);

    // Placeholder points for the intersection points; You need specific geometric algorithms to find these
    Point E = {0, 0}; // Intersection on OA
    Point F = {0, 0}; // Intersection on OB
    Point G = {0, 0}; // Intersection on OE
    Point H = {0, 0}; // Intersection on OF
    Point C = {0, 0}; // Intersection on OA
    Point D = {0, 0}; // Intersection on OB

    // Open an SVG file to output the construction
    std::ofstream svgFile("construction.svg");
    svgFile << "<svg viewBox='-10 -5 20 15' xmlns='http://w...content-available-to-author-only...3.org/2000/svg'>";

    // Draw line OA and OB
    svgFile << "<line x1='" << O.x << "' y1='" << O.y << "' x2='" << A.x << "' y2='" << A.y << "' stroke='black'/>";
    svgFile << "<line x1='" << O.x << "' y1='" << O.y << "' x2='" << B.x << "' y2='" << B.y << "' stroke='black'/>";

    // Draw arcs with center O and P
    svgFile << "<circle cx='" << O.x << "' cy='" << O.y << "' r='" << radius << "' fill='none' stroke='blue'/>";
    svgFile << "<circle cx='" << P.x << "' cy='" << P.y << "' r='" << radius << "' fill='none' stroke='green'/>";

    // Draw points O, A, B, and P
    // ...

    // Draw lines CP and DP
    // ...

    // Draw line l through G and H (assuming that points G and H have been calculated)
    // ...

    // End the SVG file
    svgFile << "</svg>";
    svgFile.close();

    std::cout << "The construction diagram has been generated and saved to 'construction.svg'." << std::endl;

    return 0;
}
stdout
Hello World