-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodevitbox.cpp
More file actions
66 lines (65 loc) · 1.17 KB
/
codevitbox.cpp
File metadata and controls
66 lines (65 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include<stdio.h>
#include <conio.h>
#include<time.h>
#include <string.h>
#include <ctype.h>
#include<windows.h>
void clrscr(void)
{
system("cls") ; //clear screen.
}
int wherex()
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),&csbi);
return csbi.dwCursorPosition.X;
}
int wherey()
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),&csbi);
return csbi.dwCursorPosition.Y;
}
void gotoxy(short x, short y)
{
COORD pos = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
int main()
{
int n,i,j,x,k,ai[1000],aj[1000],mi=0,mj=0,t;
printf("enter the size:");
scanf("%d",&n);
printf("\n\nTHE REQUIRED OUPUT IS \n\n");
x=n*2+1;
t=x;
for(k=1;k<=n;k++)
{
for(i=0;i<x;i++)
{
for(j=0;j<x;j++)
if(i==0 || i==x-1 || j==0 || j==x-1)
{ ai[mi++]=i;aj[mj++]=j; } //printf("*\t");*
/* else
printf("\t"); */
// printf("\n");
}
x-=2;
// gotoxy(0,5);
}
for(i=0;i<t;i++)
{
for(j=0;j<t;j++)
{
for(k=0;k<mi;k++)
{
if(i==ai[k] && j==aj[k])
{ printf("* ");break;}
}
if(k==mi)
printf(" ");
}
printf("\n");
}
getch();
}