Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

C Exercise 62

C Exercise 62

100 Classic C Language Examples 100 Classic C Language Examples

**Problem:** Learn to use putpixel to draw a point (implemented in TC).

**Analysis:** None.

Program source code:



//  Created by www.runoob.com on 15/11/9.

//  Copyright © 2015 Runoob Tutorial. All rights reserved.

//



#include "stdio.h"

#include "graphics.h"

int main()

{

    int i,j,driver=VGA,mode=VGAHI;

    initgraph(&driver,&mode,"");

    setbkcolor(YELLOW);

    for(i=50;i<=230;i+=20)

        for(j=50;j<=230;j++)

            putpixel(i,j,1);

    for(j=50;j<=230;j+=20)

        for(i=50;i<=230;i++)

            putpixel(i,j,1);

}

100 Classic C Language Examples 100 Classic C Language Examples