How to Make Wifi Antenna in c graphics programming using turbo c++
#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: %s\n",
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;
}
0 comments:
Post a Comment