how can u draw a rectangle in C
Answers were Sorted based on User's Feedback
Answer / ketan bhavsar
Using a rectangle(int,int,int,int)function of c graphics.
Is This Answer Correct ? | 431 Yes | 38 No |
Answer / m.d.balaji
using rectangle(int,int,int,int)
<left,top,right,bottom>
it is a function in graphics.h
Is This Answer Correct ? | 228 Yes | 21 No |
Answer / m.d.balaji
USING rectangle(int,int,int,int)
it is a function in graphics.h
Is This Answer Correct ? | 135 Yes | 20 No |
Answer / sala
including graphics.h
then initialising graphics system using initgraph
and using the function rectangle(int left,int top,int
right,int bottom)
Is This Answer Correct ? | 114 Yes | 15 No |
Answer / raj
/* simple.c
example 1.0
*/
#include<graphics.h>
#include<conio.h>
void main()
{
int gd=DETECT, gm;
initgraph(&gd, &gm, "c:\\turboc3\\bgi " );
rectangle(200,50,350,150);
getch();
closegraph();
}
Is This Answer Correct ? | 105 Yes | 13 No |
Answer / suganya
using rectangle(int right,int top,int left,int bottom) in
graphics.h
Is This Answer Correct ? | 83 Yes | 21 No |
Answer / mahendra microsoft
/* simple.c
example 1.0
*/
#include<graphics.h>
#include<conio.h>
void main()
{
int gd=DETECT, gm;
initgraph(&gd, &gm, "c:\\turboc3\\bgi " );
rectangle(200,50,350,150);
getch();
closegraph();
}
Is This Answer Correct ? | 67 Yes | 12 No |
Answer / venkat
BY using #include<graphics.h>
we can draw rectangle.
The syntax is rectangle(int ,int ,int ,int)
{left,top,right,bottom}
Is This Answer Correct ? | 56 Yes | 7 No |
Answer / azad
first include the graphics.h file
thus you can use the rectangle funtion give the proper
parameters and the wor is done
Is This Answer Correct ? | 56 Yes | 17 No |
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,(*pp).y); printf("origin is (%d%d)\n",pp->x,pp->y); }
main() { printf("%d", out); } int out=100;
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
Sir... please give some important coding questions asked by product companies..
#define max 5 #define int arr1[max] main() { typedef char arr2[max]; arr1 list={0,1,2,3,4}; arr2 name="name"; printf("%d %s",list[0],name); }
What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;
void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }
main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j), *(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i)); } }
Print an integer using only putchar. Try doing it without using extra storage.
main() { void swap(); int x=10,y=8; swap(&x,&y); printf("x=%d y=%d",x,y); } void swap(int *a, int *b) { *a ^= *b, *b ^= *a, *a ^= *b; }
Which one is taking more time and why ? :/home/amaresh/Testing# cat time.c //#include <stdio.h> #define EOF -1 int main() { register int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } ------------------- WIth stdio.h:- :/home/amaresh/Testing# time ./time_header hi hi hru? hru? real 0 m4.202s user 0 m0.000s sys 0 m0.004s ------------------ Witout stdio.h and with #define EOF -1 =================== /home/amaresh/Testing# time ./time_EOF hi hi hru? hru? real 0 m4.805s user 0 m0.004s sys 0 m0.004s -- From above two case , why 2nd case is taking more time ?