Q:

Write a C Program to perform Fish Movement in graphics

0

Write a C Program to perform Fish Movement in graphics. Here’s simple Program to perform Fish Movement in graphics in C Programming Language.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Below is the source code for C Program to perform Fish Movement in graphics which is successfully compiled and run on Windows System to produce desired output as shown below :

 
 


SOURCE CODE : :

/*  C Program to perform Fish Movement in graphics  */

#include<stdlib.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
#include<ctype.h>
void main() {
        int gd=DETECT,gm;
        int newx=0,newy=0,inc_y=5;
        initgraph(&gd,&gm," ");
        cleardevice();
        while(!kbhit()) {
                ellipse(520-newx,200,30,330,90,30);
                circle(450-newx,193,3);
                line(430-newx,200,450-newx,200);
                line(597-newx,185,630-newx,170);
                line(597-newx,215,630-newx,227);
                line(630-newx,170,630-newx,227);
                line(597-newx,200,630-newx,200);
                line(597-newx,192,630-newx,187);
                line(597-newx,207,630-newx,213);
                line(500-newx,190,540-newx,150+newy);
                line(530-newx,190,540-newx,150+newy);
                if(newx>=500)
                                        newx=0;
                if(newy>=82)
                                        inc_y=-5;
                newx=newx+5;
                if(newy<=0)
                                        inc_y=5;
                newy=newy+inc_y;
                delay(50);
                cleardevice();
        }
        cleardevice();
}

Above is the source code for C Program to perform Fish Movements in graphics which is successfully compiled and run on Windows System.The Output of the program is shown above .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Graphic Solved Programs – C Programming

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C Program to perform Pendulum in graphics... >>