C++ program to draw a Pixel by accepting coordinates from the user
kw.cpp
#include <graphics.h>
#include <iostream>
using namespace std;
int main()
{
    int gd = 0, gm = 9, x1, y1;
    cout << "Enter the x coordinate ";
    cin >> x1;
    cout << "Enter the y coordinate ";
    cin >> y1;
    initgraph(&gd, &gm, NULL);
    putpixel(x1, y1, 15);
    delay(2000);
    return 0;
}
Output
kodingwindow@kw:~$ g++ kw.cpp -lgraph
kodingwindow@kw:~$ ./a.out Enter the x coordinate 50 Enter the y coordinate 50
Advertisement