C/C++ Graphics Program to Draw Wireless Wifi Antenna Animation in Command Line

Here, You are going to learn the topic “C/C++ Graphics Program to Draw Wireless Wifi Antenna Animation in Command Line” using this article. Shall we start the article to learn about it? Come on! Let’s go.

C/C++ Graphics Program to Draw Wireless Wifi Antenna Animation in Command Line

C/C++ Graphics Program to Draw Wireless Wifi Antenna Animation in Command Line

Program Code

#include <stdio.h>

  #include <conio.h>

  #include <graphics.h>

  #include <dos.h>



  int main() {

        /* request auto detection */

        int gdriver = DETECT, gmode, err;

        int midx, y, radius = 5;

        int k = 0, stangle, endangle;



        /* initialize graphic mode */

        initgraph(&gdriver, &gmode, "C:/TURBOC3/BGI");

        err = graphresult();



        if (err != grOk) {

                /* error occurred */

                printf("Graphics Error: %sn",

                grapherrormsg(err));

                getch();

                return 0;

        }



        /* mid position in x-axis */

        midx = getmaxx() / 2;

        /* calculating the position of y */

        y = (3 * getmaxy()) / 4;



        /* start and end angles of signals */

        stangle = 120;

        endangle = 200;



        while (!kbhit()) {

                k = 0, radius = 5;



                /* clears graphic screen */

                cleardevice();



                /* construct antenna using lines */

                line(midx - 50, getmaxy(), midx, y);

                line(midx + 50, getmaxy(), midx, y);

                line(midx - 25, getmaxy(), midx, y);

                line(midx + 25, getmaxy(), midx, y);

                line(midx - 45, getmaxy() - 10, midx + 45, getmaxy() - 10);

                line(midx - 30, getmaxy() - 50, midx + 30, getmaxy() - 50);

                line(midx - 16, getmaxy() - 80, midx + 16, getmaxy() - 80);



                /* signals from the antenna */

                while (k < 18) {

                        /* signal at the left side */

                        arc(midx, y, stangle, endangle, radius);

                        /* signal at the right side */

                        arc(midx, y, 0, 60, radius);

                        arc(midx, y, 340, 360, radius);

                        radius = radius + 15;

                        delay(50);

                        k++;

                }

        }



        getch();



        /* deallocate memory allocated for graphic screen */

        closegraph();



        return 0;

  }

Final Words

We hope this article about “C/C++ Graphics Program to Draw Wireless Wifi Antenna Animation in Command Line” will be beneficial to you. If you have any doubts regarding this topic then ask us via the comment section. Share this article with other C/C++ learners via social media to help them.

Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment