how can u draw a rectangle in C

Answers were Sorted based on User's Feedback



how can u draw a rectangle in C..

Answer / priyanka

#include<graphics.h>
#include<conio.h>
#include<stdio.h>
void main()
{
int gdrive=DETECT,gmode;
initgraph (&gdrive,&gmode,"c:\tc\bin");
rectangle((50,50),(50,100),(100,100),(100,50));
getch();
}

Is This Answer Correct ?    2 Yes 2 No

how can u draw a rectangle in C..

Answer / logeshwaran

rectangle

Is This Answer Correct ?    2 Yes 2 No

how can u draw a rectangle in C..

Answer / pramod

printf("Rectangle");

Is This Answer Correct ?    2 Yes 2 No

how can u draw a rectangle in C..

Answer / anjali

by using C compiler and keyboard.

Is This Answer Correct ?    1 Yes 1 No

how can u draw a rectangle in C..

Answer / priyanka

rectangle(int,int,int,int);
and with few parameters
and der's no necessity of using graphics.h
n sorry if i am wrong. . .

Is This Answer Correct ?    1 Yes 1 No

how can u draw a rectangle in C..

Answer / nithiya

#include<grpahics.h>
void main()
{
int gd=0,gm;
initgraph(&gd,&gm,"x:\\tc\\bgi");
rectangle(int,int,int,int);
}

Is This Answer Correct ?    1 Yes 1 No

how can u draw a rectangle in C..

Answer / amaresh

rect(x1,y2,x2,y2)

Is This Answer Correct ?    0 Yes 0 No

how can u draw a rectangle in C..

Answer / akshay

Include graphics library
then either use rectangle function in it or using line fuction
adjust coordinates for it to make a rectangle

Is This Answer Correct ?    1 Yes 2 No

how can u draw a rectangle in C..

Answer / ram kumar

include the header file graphics.h
use the built in function rect(x1,y1,x2,y2)
such that (x1,y1) and (x2,y2) are the coordinates

Is This Answer Correct ?    10 Yes 12 No

how can u draw a rectangle in C..

Answer / nitheesh

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int left, top, right, bottom;

/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");

/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg
(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More C Code Interview Questions

const int perplexed = 2; #define perplexed 3 main() { #ifdef perplexed #undef perplexed #define perplexed 4 #endif printf("%d",perplexed); } a. 0 b. 2 c. 4 d. none of the above

1 Answers   emc2, HCL,


main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d ", x--); } } a. 5, 3, 1 b. 5, 2, 1, c. 5, 3, 1, -1, 3 d. –3, -1, 1, 3, 5

2 Answers   HCL,


main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }

9 Answers   CSC, GoDB Tech, IBM,


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); }

1 Answers  


main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }

1 Answers  






Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);

1 Answers  


void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); }

1 Answers  


void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(“%d”,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(“%d”,*cptr); }

1 Answers  


main() { int k=1; printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE"); }

1 Answers  


find A^B using Recursive function

2 Answers  


which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.

2 Answers  


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  


Categories