how can u draw a rectangle in C
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.
2 Answers Mentor Graphics, Microsoft,
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
main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }
In the following pgm add a stmt in the function fun such that the address of 'a' gets stored in 'j'. main(){ int * j; void fun(int **); fun(&j); } void fun(int **k) { int a =0; /* add a stmt here*/ }
What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
how to return a multiple value from a function?
main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }
programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h
main(){ char a[100]; a[0]='a';a[1]]='b';a[2]='c';a[4]='d'; abc(a); } abc(char a[]){ a++; printf("%c",*a); a++; printf("%c",*a); }
main() { printf("%x",-1<<4); }
main() { char *cptr,c; void *vptr,v; c=10; v=0; cptr=&c; vptr=&v; printf("%c%v",c,v); }