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 |
main() { extern out; printf("%d", out); } int out=100;
Write a C program to print look and say sequence? For example if u get the input as 1 then the sequence is 11 21 1211 111221 312211 12112221 .......(it counts the no. of 1s,2s etc which is in successive order) and this sequence is used in run-length encoding.
main() { int i =10, j = 20; clrscr(); printf("%d, %d, ", j-- , --i); printf("%d, %d ", j++ , ++i); } a. 20, 10, 20, 10 b. 20, 9, 20, 10 c. 20, 9, 19, 10 d. 19, 9, 20, 10
write a origram swaoing valu without 3rd variable
struct Foo { char *pName; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); strcpy(obj->pName,"Your Name"); printf("%s", obj->pName); } a. Your Name b. compile error c. Name d. Runtime error
All the combinations of prime numbers whose sum gives 32
Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??
Find your day from your DOB?
15 Answers Accenture, Microsoft,
what will be the position of the file marker? a: fseek(ptr,0,SEEK_SET); b: fseek(ptr,0,SEEK_CUR);
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
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }
What is the output for the following program main() { int arr2D[3][3]; printf("%d\n", ((arr2D==* arr2D)&&(* arr2D == arr2D[0])) ); }