/* Program Description: Using While loop statement
Author: chavez
Date Written: Feb. 04,2013
*/
void gotoxy(int x , int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
/*Function Declaration*/
void DrawBox(int x1,int y1, int x2, int y2);
/*Public Declaration of Variables*/
int x1,y1,x2,y2;
main()
{
system("cls");
printf("Enter an Integer For X1:"); scanf("%d",&x1);
printf("Enter an Integer For Y1:"); scanf("%d",&y1);
printf("Enter an Integer For X2:"); scanf("%d",&x2);
printf("Enter an Integer For Y2:"); scanf("%d",&y2);
getch();
}
void DrawBox(int x1,int y1, int x2, int y2)
{
int x,y;
gotoxy(x1,y1);putchar(201);/*upper left corner*/
gotoxy(x2,y1);putchar(187);/*upper right corner*/
gotoxy(x2,y2);putchar(188);/*lower right corner*/
gotoxy(x1,y2);putchar(200);/*lower left corner*/
/*186 - double vertical line*/
/*205 - double horizontal line*/
for(x=x1+1;x<x2;x++)
{
gotoxy(x,y1);putchar(205);
}
for(x=x1+1;x<x2;x++)
{
gotoxy(x,y2);putchar(205);
}
for(y=y1+1;y<y2;y++)
{
gotoxy(x1,y);putchar(186);
}
for(y=y1+1;y<y2;y++)
{
gotoxy(x2,y);putchar(186);
}
}