This is a program to draw a single pixel on the output screen. In this program we use putpixel() function to show a pixel at specified place of screen.
#include<stdio.h>
#include<dos.h>
#include<graphics.h>
#include<stdlib.h>
#include<io.h>
#include<conio.h>
#include<ctype.h>
 
/* ************************************************** */
/* C Program for a pixel into the screen */
/* Written By: Ritesh Kumar Jain */
/* ************************************************** */
 
void main(void)
{
 
      int graphdriver;
      int graphmode;
      
      graphdriver=DETECT;
      initgraph(&graphdriver,&graphmode,"\\tc\BGI");
 
      setpalette(0,4);
      setbkcolor(0);
      putpixel(50,50,RED);

      getch();
}

0 comments