If you are under some Unix terminal (xterm
, gnome-terminal
…), you can use console codes:
#include <stdio.h>
#define clear() printf("\033[H\033[J")
#define gotoxy(x,y) printf("\033[%d;%dH", (y), (x))
int main(void)
{
int number;
clear();
printf(
"Enter your number in the box below\n"
"+-----------------+\n"
"| |\n"
"+-----------------+\n"
);
gotoxy(2, 3);
scanf("%d", &number);
return 0;
}
Or using Box-drawing characters:
printf(
"Enter your number in the box below\n"
"╔═════════════════╗\n"
"║ ║\n"
"╚═════════════════╝\n"
);
More info:
man console_codes