To Plot Point Pixel on Screen in cpp using computer graphics library.In this code initialize graphics Library make background to white we find center position in X axis,& Y axis.Now we put pixel in center positions.
Code
#include<graphics.h> #include<iostream.h> #include<conio.h> #include<stdlib.h> void get_driver(){ int gDriver=DETECT,gMode; // define variables initgraph(&gDriver,&gMode,"c:\\tc\\bgi"); // initialize graphics Library setbkcolor(15); // make background to white } void main(){ get_driver();// To make function of define drivers int dx,dy,x,y; //define variables x = abs(getmaxx()/2); // To get center on x axis y = abs(getmaxy()/2); // To get center on y axis putpixel(x,y,4); //for put pix getch(); // getch used to hold program execution }
OUTPUT
(Visited 4,054 times, 1 visits today)
Written by:
I spent a lot of time to locate something similar to this