Program in Python graphics.py and C++ graphics library

Python

from graphics import *
win = GraphWin("Kite", 600, 600)
win.setBackground("grey")
poly1 = Polygon(Point(300,150), Point(400,300), Point(200,300))
poly1.setFill('orange')
poly1.draw(win)
poly2 = Polygon(Point(300,400), Point(400,300), Point(200,300))
poly2.setFill('white')
poly2.draw(win)
poly3 = Polygon(Point(300,400), Point(275,425), Point(325,425))
poly3.setFill('green')
poly3.draw(win)
l = Line(Point(275, 425), Point(100, 600))
l.setFill("brown")
l.draw(win)
win.getMouse()
win.close()
computer graphics in python and c++

C++

#include <graphics.h>
#include <iostream>
#include <conio.h>
#include <math.h>
 
using namespace std;
 
void kite()
{
    line(200, 200, 300, 100);
    line(300, 100, 400, 200);
    line(400, 200, 300, 300);
    line(300, 100, 300, 300);
    line(300,300,200,200);
    arc(300, 300, 45, 135, 140);
    setfillstyle(SOLID_FILL, 12);
 
    floodfill(301, 105, WHITE);
    setfillstyle(SOLID_FILL, 12);
 
    floodfill(299, 105, WHITE);
    setfillstyle(SOLID_FILL, WHITE);
 
    floodfill(299, 275, WHITE);
    setfillstyle(SOLID_FILL, WHITE);
 
    floodfill(301, 275, WHITE);
    line(300, 300, 250, 350);
    line(250, 350, 350, 350);
    line(300, 300, 350, 350);
    setfillstyle(SOLID_FILL, GREEN);
 
    floodfill(300, 310, WHITE);
}
int main()
{
    int gd = DETECT, gm;
    initgraph(&gd, &gm, "");
   
    kite();
   
    getch();
    closegraph();
 
    return 0;
}
Computer graphics program colorful kite

LEAVE A REPLY